Hi all,
What will happen to exceptions raised in catch block. Will it be executed or not.
My doubt raises from these snippets of code:
First: (This one from jdiscuss mock exam)
Answer given: m1 Starts 1 4
Why will it not print 2.
Since both NullPointerException & IndexOutOfBoundsException are runtime, why then only one gets raised and not the other?
Second:
Answer: compile error exception never thrown in the try body.
Should checked exception only be thrown from try block?
Also an exception thrown in finally block: "MUST" be in a try-catch/finally block(even if it is an runtime). Is this true ? because the following block does not compile:
If i add try/catch around it then it compiles fine.
Sorry for being too lengthy.. I am confused a bit regarding these concepts..
Thanks,
-Kits