Question: Given the below code: public static void main(String[] args) { try { Scanner in = new Scanner(new FileInputStream(a.txt)); } } catch (FileNotFoundException e) {
Given the below code: public static void main(String[] args) { try { Scanner in = new Scanner(new FileInputStream("a.txt")); } } catch (FileNotFoundException e) { System.out.println("There is no such file! " + e.getMessage()); } catch (Exception e) { System.out.println("I am in exception handler"); throw new RuntimeException(e); } finally { } System.out.println("I am in finally"); (a) What is the output when there IS a file named a.txt? (b) What is the output when there is no file named a.txt?
Step by Step Solution
3.39 Rating (165 Votes )
There are 3 Steps involved in it
import javautilScanner import javaio class Main public static void mainString args try Scanner in ne... View full answer
Get step-by-step solutions from verified subject matter experts
