dont let me create simple class
hi everyone , this is the code ( hole class , just for testing) :
Testit is the name of the class with the main method
Testit1 is sub-class.
The problem - in the line "Testit1 st1=new Testit1(66);" there is the following error - Quote:
No enclosing instance of type Testit is accessible. Must qualify the allocation with an
enclosing instance of type Testit (e.g. x.new A() where x is an instance of Testit).
How to fix it? I dont quite understand even what the problem is
Code:
public class Testit {
public class Testit1
{
public int a1;
public boolean b1;
public Testit1(int a)
{
this.a1=a;
b1=false;
}
};
public static void main(String[] args) {
int b=1;
Testit1 st1=new Testit1(66);
if (st1==null)
System.out.println("sorry, Testit1 is null");
else
System.out.println("Testit1 exist and the int is "+st1.a1);
}
}