// Helene Martin, CSE 142 // Demonstrates basic file reading. /* File data.txt has following content: 178 John 45.6 12 Sally */ import java.io.*; import java.util.*; public class ScannerTest { public static void main(String[] args) throws FileNotFoundException { File f = new File("data.txt"); Scanner s = new Scanner(f); System.out.println(s.hasNextDouble()); // true because ints are also doubles int num = s.nextInt(); System.out.println(num); String name = s.next(); System.out.println(name); if (s.hasNextInt()) { int val = s.nextInt(); System.out.println(val); } } }