I'm trying to make a Tetris game and I'm getting the compiler error
Shape is not an enclosing class
when I try to create an object
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 classZShape
needs an enclosing instance to be instantiated. – Sotirios Delimanolis Nov 27 '13 at 20:45AShape
andZShape
extend the base classShapes
. Nesting classes is not a really good design for this problem. – Paramvir Singh Karwal Oct 7 at 13:29