/** This class shows off how confusing variables can be. */ public class Demo { private int var; // Field named duh. /** Constructor: instance with var of 1 */ public Demo() { var = 0; } /** * Yields: a mysterious value * Looks like both a procedure and function. * Call this a function with "side-effects" */ public int getSetWTF(boolean flag) { if (flag) { int var; var = 1; } else { var = 2; } return var; } }