import java.io.*; import java.util.*; public class FileIORead { public static void main(String [] args) throws FileNotFoundException, IOException { FileReader inFile; inFile = new FileReader("D:\\Program\\acc.txt"); Scanner fileSca; fileSca = new Scanner(inFile); int accountNum; double balance; // Read the account number accountNum = fileSca.nextInt(); // Read the balance balance = fileSca.nextDouble(); System.out.println("The account number is "+accountNum); System.out.println("Its balance is "+balance); inFile.close(); // Read an integer from the file // int i = fileSca.nextInt(); // Read a double from the file // double d = fileSca.nextDouble(); // Read a string from the file // String str = fileSca.next(); // Get the 0th character in the String str; // char c = str.charAt(0); // Determine whether it is end of the file // boolean b = fileSca.hasNext(); } }