package Examples; public class DiverseInstructions { public static final Integer finalStaticField = Integer.valueOf(300); public static String[][] staticField; static { staticField = new String[2][4]; staticField[0] = new String[] {"Statically initialized field"}; } public String instanceField; private final Number finalInstanceField; public DiverseInstructions() { instanceField = "Constructor initializing field"; finalInstanceField = new Integer(800); } public void invoke() { Comparable n = finalStaticField; n.compareTo((Integer) finalInstanceField); invokeSpecial(n); } private Runnable invokeSpecial(Object o) { int j = 0; if(o instanceof Number) j -= 400; final int i = j; return new Runnable() { public void run() { if(i>2) instanceField = "i>2 in anonymous innerclass"; else staticField[1][1] = "i<=2 in anonymous innerclass"; } }; } }