import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; import java.util.InputMismatchException; public class Main { public static void processFile(String fname) throws FileNotFoundException, InputMismatchException, NegativeIntegerException { Scanner inFile = new Scanner(new File(fname)); int x = inFile.nextInt(); if (x<0) throw new NegativeIntegerException(); System.out.println("Data is: "+x); inFile.close(); } public static void main(String[] args) { Scanner in = new Scanner(System.in); try { System.out.print("Input the file pathname: "); String fname = in.next(); processFile(fname); } catch (Exception e) { System.out.println("Some problem happens."); } catch (NegativeIntegerException e) { System.out.println("Unexpected negative value from the file."); } in.close(); } } /* Rundown 1 */ /* Rundown 2 */