filmov
tv
35 Java Exception Core Java Interview Questions and Answers

Показать описание
1.What Is Exception ?
Exception is abnormal conduction that can be handled .an Other Word An unwanted, unexpected event that disturbs normal flow of the program is Exception.
2. What is Error?
That Abnormal conduction that can't be handled that is called error .ex System failler.
3. What is the purpose of Exception handling ?
The main purpose of Exception of handling is for graceful termination of the program.
4. What is meaning of Exception handling ?
Exception Handling dosen't mean repairing the exception we have to define alternative way to continue the rest of code normally.
5. What is the purpose of the try block?
We should maintain the risky code inside try blog.
6. What is the purpose of the catch block ?
We have maintain all the Exception handling code in side the catch block.
7. What is try ?
Some time interviewer ask this type of question and try to confuse you but don't confuse answer is so simple try is key word in java. If interviewer ask what is try block than ans .
8. What is catch ?
Same case as a try catch is also key word in java.
9. Is try block with multiple catch Block possible?
Yes its possible You can Write a try block with multiple catch block for separate catch block for every exception.
10. If try multiple catch block present is order of catch block is important in which order we have to take?
If try multiple catch block present is order of catch block is important it should from child to parent not parent to child.
11. what are the various method in Exception class?
There are various method in Exception class
12. If an exception raised catch block what will happened ?
If an Exception raised in catch block and it is not part of any try block then it is always abnormal termination.
13. it is possible try catch block inside the catch block?
Yes it is possible to take try,catch block inside the catch block.
14. what is the purpose of finally block ?
The main purpose of finally block is to maintain the cleanup code.This block will execute always.
15. It is possible try block without catch block?
Yes It is possible try block without catch block using finally block it.
16.In which case finally block will not executed ?
17. If return statement present in try block is finally block will be executed ?
Yes if return statement present in inside try block then also finally block will executed finally block will dominate return statement also.
18. what is difference between final ,finally,finalize() ?
Final - final is modifier applicable on variable and methods and class.Final variable means constant and reassign not be possible .
Finally -- finally is block that associated with try catch block to maintain the cleanup code.
Finalize() -- Finalize is method of object class garbage collector always called this method just before destroying any object to perform clean up activity.
A Job Portal
Other Top Job Portals
Are you looking for a new Job ?
Комментарии