Considering the piece of the code above:
public class ConditionalCompile {
private static final boolean DEBUG = false;
public static void main(String args[]) {
if(DEBUG){
System.out.println("Hello, world!");
}
}
}After compiled, and use javap to see the result:
public static void main(java.lang.String[]);
Code:
Stack=0, Locals=1, Args_size=1
0: return
LineNumberTable:
line 8: 0The whole if statement is gone after compiled because the value of DEBUG is false.