The above code compiles & runs fine. Shouldn't th above code give complier error that "Unreachable statement"?Co line 1 is never reached What are the scenarios when compiler throws unreachable statement error?Are these kind of questions ,where compiler gives error that"Unreachable statement" going to appear in the exam? thanks Veena
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
posted 12 years ago
Method m1() might throw an exception that would halt the program as opposed to having a straight statement like throw new Exception(); A call to a method throwing an exception shouldn't make a statement immediately after it unreachable. Don't forget, m1() can be overridden not to throw any exception.