Discussion :: Exceptions - Pointing out the correct statements (Q.No.2)
Prashanta said: (Nov 23, 2011) | |
I think the answer is C. Finally block will be all time executed whether catch block are belong there or not. but it it will executed at the last time. |
Sundar said: (Dec 14, 2011) | |
The given answer is correct. I have tested it.D:\Java>javac Test.java Hope this will help you. Have a nice day! |
Saroj Das said: (Mar 9, 2012) | |
I think answer is C Hello world Exception in thread "main" java.lang.RuntimeException at MyProgram.throwit(MyProgram.java:6) at MyProgram.main(MyProgram.java:13) Finally executing |
Alis said: (Sep 15, 2013) | |
I don't think it's predictable. I ran the class a number of times and have seen different order of expressions in standard output. |
Archana said: (Jan 2, 2015) | |
Hello world. Exception in thread "main" java.lang.RuntimeException. Finally executing: at MyProgram.throwit(MyProgram.java:5). at MyProgram.main(MyProgram.java:12). Java Result: 1. And after executing second time o/p is : Hello world. Finally executing. Exception in thread "main" java.lang.RuntimeException. at MyProgram.throwit(MyProgram.java:5). at MyProgram.main(MyProgram.java:12). Java Result: 1. Output is not predictable. |
Sai Prasad said: (Jul 25, 2016) | |
Hello world Exception in thread "main" java.lang.RuntimeException. Finally executing at javaapplication8.JavaApplication8.throwit(JavaApplication8.java:8) at javaapplication8.JavaApplication8.main(JavaApplication8.java:16) Java Result: 1 BUILD SUCCESSFUL (total time: 0 sec) |
Sasikanta said: (Nov 15, 2017) | |
I am getting below error at line 5 i.e " throw new RuntimeException();" No exception of type RuntimeException can be thrown; an exception type must be a subclass of Throwable. |
Post your comments here:
Name *:
Email : (optional)
» Your comments will be displayed only after manual approval.