Conditional compilation in Java: will compiler omit "always false" blocks from class?
<p>Below is a snippet of my code:</p>

<pre><code>class A { 

   private boolean debug = false;

   // Called when server boots up.
   public void init (property) { 
      debug = property.getBoolean ("debug_var"); // read debug from a config file.
   }

   // some other function  
   public void foo () { 
       if (debug) { 
                 System.out.println ("From inside the debug block");
       }
   }
 }
</code></pre>

<p>When I run the code, if (debug) actually prints out "From inside debug block" if debug == true in the config file. </p>

<p>Two Questions:</p>

<ol>
<li><p>So, in this case does the compiler include the if block in the .class file just because the value of variable debug might change on run time? </p></li>
<li><p>If this is true, then how can I eliminate some code from being added to the .class file on certain environments? </p></li>
</ol>
