Question: 11. Given the code below, if the program crashes at run time then write program crashes otherwise write what the output is after executing the
11. Given the code below, if the program crashes at run time then write program crashes otherwise write what the output is after executing the following main method, [2,2,2=6]
import java.io.File;
import java.util.Scanner;
import java.io.FileNotFoundException;
public class Q11 {
public static void catchQuestion() throws FileNotFoundException{ // assume "nowhere.txt" does not exist
System.out.println("R"); Scanner test3 = new Scanner(new File("nowhere.txt")); System.out.println("A"); }
public static void main(String[] args) { try { catchQuestion(); System.out.println("Z"); }
catch (FileNotFoundException e) { System.out.println("W"); }
System.out.println("B"); } }
Answer:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
