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();