class Outer { public int outerMember = 9; class NonStaticInner { private int i = 1; public int value() { return i + Outer.this.outerMember; // OK, putem accesa un membru al clasei exterioare } } static class StaticInner { public int k = 99; public int value() { k += outerMember; // EROARE, nu putem accesa un membru nestatic al clasei exterioare return k; } } } public class Test { public static void main(String[] args) { Outer out = new Outer (); Outer.NonStaticInner nonSt = out.new NonStaticInner(); // instantiere CORECTA pt o clasa nestatica Outer.StaticInner st = out.new StaticInner(); // instantiere INCORECTA a clasei statice Outer.StaticInner st2 = new Outer.StaticInner(); // instantiere CORECTA a clasei statice } }