I am exploring the inner classes of Java.
I wrote an example:
public class Outer { public Outer(int a){} public class Inner { public Inner(String str, Boolean b){} } public static class Nested extends Inner{ public static void m(){ System.out.println("hello"); } public Nested(String str, Boolean b , Number nm) { super("2",true); } } public class InnerTest extends Nested{ public InnerTest(){ super("str",true,12); } } }
I call it from main using the following line:
new Outer(1).new Inner("",true);
I see a compilation error:
java: no enclosing instance of type testInheritancefromInner.Outer is in scope
Can you explain this situation to me?
UPDATE

java inheritance instantiation inner-classes
gstackoverflow
source share