자바에서 이게 왜 에러가 나는거죠?

조회수 11239회

테트리스 게임을 만들고있는데요. 아래 코드를 실행하면 Shape is not an enclosing class라는 메세지가 나와요.

public class Test {
    public static void main(String[] args) {
        Shape s = new Shape.ZShape();
    }
}
public class Shape {

    private String shape;
    private int[][] coords;
    private int[][] noShapeCoords = { { 0, 0 },   { 0, 0 },   { 0, 0 },   { 0, 0 } };
    private int[][] zShapeCoords = { { 0, -1 },  { 0, 0 },   { -1, 0 },  { -1, 1 } };
    private int[][] sShapeCoords = { { 0, -1 },  { 0, 0 },   { 1, 0 },   { 1, 1 } };
    private int[][] lineShapeCoords = { { 0, -1 },  { 0, 0 },   { 0, 1 },   { 0, 2 } };
    private int[][] tShapeCoords = { { -1, 0 },  { 0, 0 },   { 1, 0 },   { 0, 1 } };
    private int[][] squareShapeCoords = { { 0, 0 },   { 1, 0 },   { 0, 1 },   { 1, 1 }   };
    private int[][] lShapeCoords = { { -1, -1 }, { 0, -1 },  { 0, 0 },   { 0, 1 } };
    private int[][] mirroredLShapeCoords = { { 1, -1 },  { 0, -1 },  { 0, 0 },   { 0, 1 } };

    public Shape(){
        int[][] coords =  noShapeCoords;
        shape = "NoShape";
    }

    class ZShape{
        int[][] coords =  zShapeCoords;
        String shape = "ZShape";
    }

    class SShape{
        int[][] coords = sShapeCoords;
        String shape = "SShape";
    }

 //etc
}

뭐가 잘못된거죠?

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)