Below is my code when I comment on operator-2, then it corresponds to fines, but when I uncomment, it gives a compile-time error "Unreachable Code".
I understand why I get an error message after terminating it, but my question is even if I comment on it but is bad()unavailable, since I am an throwingexception - this is catch, then why doesn’t it give an error for it?
class Varr
{
public static void main(String[] args) throws Exception
{
System.out.println("Main");
try {
good();
} catch (Exception e) {
System.out.println("Main catch");
throw new RuntimeException("RE");
} finally {
System.out.println("Main Finally");
throw new RuntimeException("RE2");
}
bad();
}
}
source
share