adplus-dvertising
frame-decoration

Question

Given that EOFException and FileNotFoundException are both subclasses of IOException, and further assuming this block of code is placed into a class, which statement is most true concerning this code?
System.out.print("Start ");
try 
{
    System.out.print("Hello world");
    throw new FileNotFoundException();
}
System.out.print(" Catch Here "); /* Line 7 */
catch(EOFException e) 
{
    System.out.print("End of file exception");
}
catch(FileNotFoundException e) 
{
    System.out.print("File not found");
}

a.

The code will not compile.

b.

Code output: Start Hello world File Not Found.

c.

Code output: Start Hello world End of file exception.

d.

Code output: Start Hello world Catch Here File not found.

Posted under Java Programming

Answer: (a).The code will not compile.

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Given that EOFException and FileNotFoundException are both subclasses of IOException, and further assuming this block of code is placed into a class, which statement is most true...

Similar Questions

Discover Related MCQs

Q. Which of these keywords is used to by the calling function to guard against the exception that is thrown by called function?

Q. Which of these operator is used to generate an instance of an exception than can be thrown by using throw?

Q. Which of these class is related to all the exceptions that are explicitly thrown?

Q. Which of these keywords is used to generate an exception explicitly?

Q. What exception thrown by parseInt() method?

Q. Which of these handles the exception when no catch is used?

Q. Which of these class is related to all the exceptions that cannot be caught?

Q. Which of these class is related to all the exceptions that can be caught by using catch?

Q. Which of these is a super class of all exceptional type classes?

Q. Which of these classes is super class of Exception class?

Q. Which of these methods return localized description of an exception?

Q. Which of these methods is used to print stack trace?

Q. Which of these methods return description of an exception?

Q. Which of these classes is used to define exceptions?

Q. Which of these statements is incorrect?

Q. Which of these keywords are used for the block to be examined for exceptions?

Q. Which of these clause will be executed even if no exceptions are found?

Q. At runtime, error is recoverable.

Q. Which of the following should be true of the object thrown by a thrown statement?

Q. Which part of code gets executed whether exception is caught or not?