Thinking in Java Fourth Edition Bruce Eckel Chapter 5 Exercise 3

Exercise 3: Create two packages: debug and debugoff, containing an identical class with a debug( ) method. The first version displays its String argument to the console, the second does nothing. Use a static import line to import the class into a test program, and demonstrate the conditional compilation effect.

package access.debug;

public class Debug
{
    public static void debug(String s)
    {
        System.out.println(s);
    }
}
package access.debugoff;

public class Debug
{
    public static void debug(String s)
    {
    }
}

2 Replies to “Thinking in Java Fourth Edition Bruce Eckel Chapter 5 Exercise 3”

  1. An outstanding share! I have just forwarded this onto a co-worker who was
    doing a little homework on this. And he in fact bought me breakfast simply because I found it for him…
    lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx
    for spending time to discuss this issue here on your internet site.

Leave a Reply

Your email address will not be published. Required fields are marked *