C style conditional compilation—not legal in Java.

Lab Notes™
Conditional compilation in Java
Matt Brenner
Listing 2. C style conditional compilation—not legal in Java.


  1	#define		DEBUG
  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		public String
 15		toString()
 16		{
 17			StringBuffer	text;
 18
 19
 20			text = new StringBuffer();
 21			text.append (super.toString());
 22			text.append ("----- X -----\n");
 23			text.append ("x: " + x_ + "\n");
 24			text.append ("y: " + y_ + "\n");
 25			text.append ("z: " + z_ + "\n");
 26
 27			return (text.toString());
 28		}
 29	#endif
 30
 31	}