Question
class Test extends Exception { }
class Main {
public static void main(String args[]) {
try {
throw new Test();
}
catch(Test t) {
System.out.println("Got the Test Exception");
}
finally {
System.out.println("Inside finally block ");
}
}
}
a.
Got the Test Exception Inside finally block
b.
Got the Test Exception
c.
Compiler Error
d.
Inside finally block
Posted under Java Programming
Inside finally block
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What will be output for the following code?
Similar Questions
Discover Related MCQs
Q. Which exception is thrown when divide by zero statement executes?
View solution
Q. In which of the following package Exception class exist?
View solution
Q. Which of these is a super class of all errors and exceptions in the Java language?
View solution
Q. Which statement is true?
View solution
Q. Which statement is true?
View solution
Q. Which statement is true?
View solution
Q. Which four can be thrown using the throw statement?
1. Error
2. Event
3. Object
4. Throwable
5. Exception
6. RuntimeException
View solution
Q. Which statement is true?
View solution
Q. Which of these keywords is used to by the calling function to guard against the exception that is thrown by called function?
View solution
Q. Which of these operator is used to generate an instance of an exception than can be thrown by using throw?
View solution
Q. Which of these class is related to all the exceptions that are explicitly thrown?
View solution
Q. Which of these keywords is used to generate an exception explicitly?
View solution
Q. What exception thrown by parseInt() method?
View solution
Q. Which of these handles the exception when no catch is used?
View solution
Q. Which of these class is related to all the exceptions that cannot be caught?
View solution
Q. Which of these class is related to all the exceptions that can be caught by using catch?
View solution
Q. Which of these is a super class of all exceptional type classes?
View solution
Q. Which of these classes is super class of Exception class?
View solution
Q. Which of these methods return localized description of an exception?
View solution
Q. Which of these methods is used to print stack trace?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!