Variable Name     Value in Memory
x
[0]
[1]
...
[9]
number
0 1 2 3 4 5 6 7 8 9
a a a a a a a a a a
b a a a a a a a a a
hex
city2
empty string
empty string
  1  import java.util.Scanner; 
  2  
  3  public class ReadData {
  4    public static void main(String[] args) throws Exception {
  5      // Create a File instance
  6      java.io.File file = new java.io.File("scores.txt");
  7  
  8      // Create a Scanner for the file
  9      Scanner input = new Scanner(file);
 10  
 11      // Read data from a file
 12      while (input.hasNext()) {
 13        String firstName = input.next();
 14        String mi = input.next();
 15        String lastName = input.next();
 16        int score = input.nextInt();
 17        System.out.println(
 18          firstName + " " + mi + " " + lastName + " " + score);
 19      }
 20  
 21      // Close the file
 22      input.close();
 23    }
 24  }
            

File scores.txt

Console Output