class MyClass {
void show() {
try {
int k = 20/0;
} catch(RuntimeException e) {
if(5>2)
throw new IllegalAccessException();
}
finally {
System.out.println("in finally");
}
}
public static void main(
String args[]) {
new MyClass().show();
}
}
__________
the above pragram gives a compile-time error becos, a checked exception can't be thrown from the catch block directly(or it must be declared in the throws clause of the method).
here is another code:
_________
class MyClass {
int show() {
try {
int k = 20/0;
return 10;
} catch(RuntimeException e) {
if(5>2)
throw new IllegalAccessException();
return 4;
}
finally {
System.out.println("in finally");
return 30;
}
}
public static void main(String args[]) {
new MyClass().show();
}
}
_________
In the above code, a checked exc. is being thrown, and no throws clause in the method! but it compiles well. I couldn't understand why does it not give an error???

thanx.
ashok.