I'm trying to make a Tetris game and I'm getting the compiler error when I try to create an object
Shape is not an enclosing class
public class Test {
public static void main(String[] args) {
Shape s = new Shapes.ZShape();
}
}
I'm using inner classes for each shape. Here's part of my code
public class Shapes {
class AShape {
}
class ZShape {
}
}
What am I doing wrong?

new Shape().new ZShape();. The classZShapeneeds an enclosing instance to be instantiated.AShapeandZShapeextend the base classShapes. Nesting classes is not a really good design for this problem.