Is not an enclosing class appears in creating a Java class

Why can’t you stop buying 618?From the technical dimension to explore>>>

publicclassA{

publicclassB{

}

};

When you need to instance class B, according to the positive logic, A.B AB = new a.b()

Then the compiler will have an error — “is not an enclosing class”

Then look at the relevant java code, found that the original writing error! The right thing to do is

[java]

view plain

copy

Aa=newA();

A.Bab=a.newB();

a class in a class without static cannot be operated with an external class. An instance must be used to instantiate the class in the class

Similar Posts: