How to leave out some System.out/logging statements while executing java code?
<p>In C++ if we do not want some statements to compile into code that ships like assert function calls, we control their compilation through #ifndef preprocessor directives.</p>

<p>How do we do this in Java?</p>

<p>I have some System.out.println() statements for debugging which I would like to remove for the final code.</p>

<p>one way is to make them execute conditionally under the affect of a boolean variable. Is there a better way of doing this?</p>

<p>As I have a java swing application I can turn off the System.out.println statements without affecting the output. What is the method of doing this?</p>
