Java Interview Question And Answer 35 Java Exception Interview Question Part 3

preview_player
Показать описание
23 It is possible to throw an Error ?
Yes it is possible to throw an error any Throwable type include Error.

24. Is it Possible throw an object ?
No we can use throw keyword only throwble object otherwise we will get compile time error
Saying Unreachable Statement.

25. What is the purpose of throws key word.
Throws keyword use to propagate the exception.

This Type of question create the confusion in your mind don't confuse there is no terminology of thrown in java.

27 Explain the exception handling keyword?
Exception Handling Key word
¦try
¦catch
¦finally
¦throw
¦throws
28.Which class is the root class Java Exception Hierarchy?
Throwable class is the top class of Exception hierarchy.

29. What is the difference between Exception and Error ?
Exception : recoverable

Error:-these are not caused by our program mostly caused by lack of system resources.These are non recoverable.

30. What is difference between checked and unchecked Exception ?
That Exception Checked by compile Time is called checked exception.Ex.IOException .

The Exception which not checked by Compile time that checked by runtime is called unchecked exception Ex.ArithMaticException /0,RuntimeException;

31 What is difference partially checked and fully checked Exception?
A checked exception is said to be fully checked if and only if all the child class also checked otherwise it is called partially checked exception.
IOexception:-fully checked exception
Exception : are partially checked .
32 What are the customized exception?

Sometime based on your programming required we have to create our own exception such type exception called customize exception.

33.Can You give the name of most common exception occurred in your previous project?

NullPointerException,ArrayIndexOutOfBoundException,StackOverFlowException,ClassCastException,NoClassDefFoundError,etc.

34.Will the finally block executed if there is an exception thrown in try block ?
Yes, the finally block will override the "thrown exception" finally always dominates.

35.Can we catch "Runtime" Exception ?
Yes, you can catch or throw RuntimeException but the compiler will not complain about it since it a "Unchecked Exception".
A Job Portal

Other Top Job Portals

Are you looking for a new Job ?
Рекомендации по теме