How to leave out some statements while executing java code?
        Posted  
        
            by iamrohitbanga
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by iamrohitbanga
        
        
        
        Published on 2010-05-15T19:27:26Z
        Indexed on 
            2010/05/15
            19:34 UTC
        
        
        Read the original article
        Hit count: 265
        
java
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.
How do we do this in Java?
I have some System.out.println() statements for debugging which I would like to remove for the final code.
one way is to make them execute conditionally under the affect of a boolean variable. Is there a better way of doing this?
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?
© Stack Overflow or respective owner