void () { class ContextLocal { private int myContextLocalInt; public void contextLocalInc() { myContextLocalInt++; } } JComponent contextAnonymous = new JComponent() { private int myContextAnonymousInt; public void contextAnonymousInc() { myContextAnonymousInt++; } }; }