What's wrong?
Type:
public abstract class Type {
public class Sub1 extends Type {
public Sub1() {
super();
System.out.println("... one done!");
}
}
public class Sub2 extends Type {
public Sub2() {
super();
System.out.println("... two done!");
}
}
public class Sub3 extends Type {
public Sub3() {
super();
System.out.println("... three done!");
}
}
private static int value = 0;
protected Type() {
value++;
System.out.print("Type " + value);
}
}
TestType:
public class TestType {
public static void main(String[] args) {
System.out.println("Types creation:");
Type type1 = new Type.Sub1();
Type type2 = new Type.Sub2();
Type type3 = new Type.Sub3();
}
}
The compiler gives me the error of subject: An enclosing instance that contains Type.Sub1 is required...
but I don't understand where the problem is o_O