Descriptive Question

Quiz Guidelines

 

QID: 
55
Tags: 
Validated against: 
java8
Question: 

Based on assumptions and facts, find the output.

Assumption: filename.txt does not exist.

Fact: FileNotFoundException is a child of IOException.

Program:
 

    try {

      File file = new File("filename.txt");

      Scanner sc = new Scanner(file);

      throw new IOException();

    } catch (IOException e) {

      System.out.println("IOException called!!!");

    } catch (FileNotFoundException e) {

      System.out.println("FileNotFoundException called!!!");

    }

 

Q&A Set: