Ist keine einschließende Klasse Java

Ich versuche, mich ein tetris-Spiel und ich bin immer "Form ist nicht einer umschließenden Klasse", wenn ich versuche, ein Objekt zu erstellen

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

Ich bin mit inneren Klassen für jede Form. Hier ist ein Teil von meinem code

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
}

Was mache ich falsch ?

InformationsquelleAutor der Frage V Sebi | 2013-11-27

Schreibe einen Kommentar