Java Interview Question And Answer 35 Java Exception Interview Question Part 2
Click here - https://www.youtube.com/channel/UCd0U_xlQxdZynq09knDszXA?sub_confirmation=1 to get notifications. Java Interview Question And Answer 35 Java Exception Interview Question Part 2 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. Ex. Try()finally{} 16.In which case finally block will not executed ? There is one solution where the finally block wont be executed if we are using system.exit(0) explicity then JVM itself will be shutdown and there is no chance of executing the finally block. 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,finailize() ? Final - final is a modifier applicable on variable and methods and class.Final variable means constant and reassign not be possible . Finally -- finally is a block that associated with try catch block to maintain the cleanup code. Finalize() -- Finalize is a method of object class garbage collector always called this method just before destroying any object to perform clean up activity. 19.Is it possible to write any code with in try and catch and finally block ? No it is not possible to write any statement between try catch finally block .If we will try to write any statement between them we will get compiler error. 20. It is Possible two finally block for the same try ? No it is not possible two finally block in same try. If we try to take then we will get compile time error. 21. Is Syntax try-finally-catch is possible ? No This syntax not valid.it should be like try-catch-finally than only code will compile. 22. What is purpose of throw key word ? Some time we create a Exception implicitly and we can handover that exception object to the JVM explicitly by using throw keyword. In other word throw key use the raise the exception. Class Test { Public static void main(String arhg[]) { Throw new ArithmaticException("/by zero"); } } A Job Portal http://www.InterviewDot.com http://www.InterviewDot.com http://www.InterviewDot.com One Click Dream Job - http://www.interviewdot.com/upload-resume/uploadresume.htm Other Top Job Portals www.Naukri.com www.MonsterIndia.com www.TimesJobs.com Are you looking for a new Job ? InterviewDot.com - A Job Portal http://www.InterviewDot.com http://www.InterviewDot.com http://www.InterviewDot.com One Click Dream Job - http://www.interviewdot.com/upload-resume/uploadresume.htm
Click here - https://www.youtube.com/channel/UCd0U_xlQxdZynq09knDszXA?sub_confirmation=1 to get notifications. Java Interview Question And Answer 35 Java Exception Interview Question Part 2 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. Ex. Try()finally{} 16.In which case finally block will not executed ? There is one solution where the finally block wont be executed if we are using system.exit(0) explicity then JVM itself will be shutdown and there is no chance of executing the finally block. 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,finailize() ? Final - final is a modifier applicable on variable and methods and class.Final variable means constant and reassign not be possible . Finally -- finally is a block that associated with try catch block to maintain the cleanup code. Finalize() -- Finalize is a method of object class garbage collector always called this method just before destroying any object to perform clean up activity. 19.Is it possible to write any code with in try and catch and finally block ? No it is not possible to write any statement between try catch finally block .If we will try to write any statement between them we will get compiler error. 20. It is Possible two finally block for the same try ? No it is not possible two finally block in same try. If we try to take then we will get compile time error. 21. Is Syntax try-finally-catch is possible ? No This syntax not valid.it should be like try-catch-finally than only code will compile. 22. What is purpose of throw key word ? Some time we create a Exception implicitly and we can handover that exception object to the JVM explicitly by using throw keyword. In other word throw key use the raise the exception. Class Test { Public static void main(String arhg[]) { Throw new ArithmaticException("/by zero"); } } A Job Portal http://www.InterviewDot.com http://www.InterviewDot.com http://www.InterviewDot.com One Click Dream Job - http://www.interviewdot.com/upload-resume/uploadresume.htm Other Top Job Portals www.Naukri.com www.MonsterIndia.com www.TimesJobs.com Are you looking for a new Job ? InterviewDot.com - A Job Portal http://www.InterviewDot.com http://www.InterviewDot.com http://www.InterviewDot.com One Click Dream Job - http://www.interviewdot.com/upload-resume/uploadresume.htm