posted 16 years ago
Every try block must have a corresponding catch block
A True
B False
Well! The answer i choosed was true but mock exam says its false.
Mock explaination: A try block can be associated with either a catch block or a finally block or both.
a) I cant have a try { }finally { } correct? If try{} is throwing a compile time exception the above code will fail to compile.
b) I can have try{} finally{} compiles fine.
c) I can have try{} catch(RunTimeException e) { } , This will work even because the catch block is having a runtimeexception and not a compile time exception which would then cause a compiler error if try{} doesnt throw the compile time exception.
Does this mean the mock exam answer is correct?
Thanks
Deepak