Translating Scanner tokens into primitive types
The Scanner class can be used to break an input into tokens separated by delimiters. Scanner also has methods to translate each token into one of Java’s primitive types. Delimiters are string patterns and are set in the following way: Scanner s = new Scanner(input); s.useDelimiter(pattern); If we need to read a file containing a set of integers, and calculate the total, we can use Scanner’s nextInt method: int sum = 0; //create a new instance of Scanner Scanner s = new Scanner( new BufferedReader( new FileReader("in....