import java.util.Scanner;
class Main {
public static void main(String[] args) {
// creates an object of Scanner
Scanner input = new Scanner(System.in);
System.out.print("Enter your name: ");
// reads the entire word
String value = input.next();
System.out.println("Using next(): " + value);
input.close();
}
}
String s = "Hello World! 3 + 3.0 = 6 ";
// create a new scanner with the specified String Object
Scanner scanner = new Scanner(s);
// find the next token and print it
System.out.println("" + scanner.next()); // "Hello"
// find the next token and print it
System.out.println("" + scanner.next()); // "World!"
// close the scanner
scanner.close();