Lecture Videos
  1  import java.util.Scanner; 
  2  
  3  public class ReadDataWithAutoClose {
  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      try (
  9        // Create a Scanner for the file
 10        Scanner input = new Scanner(file);
 11      ) {
 12        // Read data from a file
 13        while (input.hasNext()) {
 14          String firstName = input.next();
 15          String mi = input.next();
 16          String lastName = input.next();
 17          int score = input.nextInt();
 18          System.out.println(
 19            firstName + " " + mi + " " + lastName + " " + score);
 20        }
 21      }
 22    }
 23  }