The following Java program cannot compile due to errors in the else clause.
public class Temp1 {
public static void main(String[] args) {
if (args.length == 0)
{
System.out.println("PASS");
}
else{
COMPILEERROR
}
}
}
Nevertheless, when run in NetBeans, after being notified of the errors and clicking "Run Anyway" the program runs and output "PASS". When the condition fails (when the args > 0), the program throws a RuntimeException:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - not a statement
How does NetNeans run uncompilable code? Is it running an interpreter / JIT compiler or something like that?
Is this a new feature since I do not recall it in the past?
throw.