Conditional compilation controlled by command line (with toString() compiled)

Lab Notes™
Conditional compilation in Java
Matt Brenner
Listing 5. Conditional compilation controlled by command line (with toString() compiled).


  1
  2
  3	public class X extends Y
  4	{
  5		private int	x_,
  6					y_,
  7					z_;
  8
  9			.
 10			.
 11			.
 12
 13	//ifdef DEBUG
 14	//
 15		public String
 16		toString()
 17		{
 18			StringBuffer	text;
 19
 20
 21			text = new StringBuffer();
 22			text.append (super.toString());
 23			text.append ("----- X -----\n");
 24			text.append ("x: " + x_ + "\n");
 25			text.append ("y: " + y_ + "\n");
 26			text.append ("z: " + z_ + "\n");
 27
 28			return (text.toString());
 29		}
 30	//endif
 31	//
 32
 33	}

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.