Code :
=================================================
class
Test {
public static void main(
String[] args)
{
int j = 1;
try
{
int i = doIt() / (j = 2);
} catch (Exception e)
{
System.out.println(" j = " + j);
}
}
public static int doIt() throws Exception {
throw new Exception("FORGET IT");//1
}
}
=================================================
Why this code compiles successfully, without return statement inside doIt() method? If remove //1, then you'll get error message "missing return statement".... :roll: