1String s = "Hello World! 3 + 3.0 = 6 ";
2
3 // create a new scanner with the specified String Object
4 Scanner scanner = new Scanner(s);
5
6 // find the next token and print it
7 System.out.println("" + scanner.next()); // "Hello"
8
9 // find the next token and print it
10 System.out.println("" + scanner.next()); // "World!"
11
12 // close the scanner
13 scanner.close();