About Question enthuware.ocajp.i.v7.2.834 :
Posted: Sun Jul 28, 2013 7:57 am
I Think there's a mistake in the explanation.
Acutally this code won't compile :
Acutally this code won't compile :
It will compile if the try/catch is in myMethod and not in the main.public class TestClass {
public static void main(String[] args){
TestClass tc = new TestClass();
try{
tc.myMethod();
} catch (Exception e){ }
}
public void myMethod() {
yourMethod();
}
public void yourMethod() throws Exception{
throw new Exception();
}
}