Search your topic in Java2share
Home > FAQs
eXTReMe Tracker


Exception Handling FAQs


Untitled Document

Q25. After throw is it allow to take any statement directly?
Ans.  After throw statement we are not allow to place any statement directly violation leads to compile time error saying Unreachable Statement.
Q26. What is the purpose of throws?
Ans.  The main purpose of throws keyword is to delegate the responsibilities of exception handling to the caller. It requires in the case of checked exception.
Q27. What is the difference between throw and throws?
Ans.   Sometimes we can create Exception object explicitly and we can handover that exception object to the JVM explicitly by throw keyword.The main purpose of throw keyword is to handover our created exception object explicitly to the JVM. The main purpose of throws keyword is to delegate the responsibilities of exception handling to the caller. It requires in the case of checked exception.

Q28.  What is the difference between throw and thrown?
Ans.   There is no terminology of thrown in  java.