Search your topic in Java2share
Home > FAQs
eXTReMe Tracker


Exception Handling FAQs


Untitled Document

Q9. What are various methods to print Exception information? and differentiate them.


Ans.

Throwable class defines the following method to print exception or error information .
1. printStackTrace() :- This method print exception information in the following format.

Name of the Exception: Description
 StackTrace

2.toString():- This method print exception information in the following format.

    Name of the Exception: Description               

3.getMessage():- This method prints only description of the exception.

    Description

Q10.If an exception rised inside catch block then what will happen?
Ans. If an exception raised inside catch block and it is not part of any try block then it is always abnormal termination.

Q11. Is it possible to take try, catch inside try block?
Ans. Yes, It is possible to take try, catch inside try block. That is nesting of try catch is possible.

Q12.Is it possible to take try, catch inside catch block?
Ans.  Yes, It is possible to take try, catch inside catch block.