0

I'm trying to make an arkanoid game and I created an enum class that holds all the levels of the game.I assigned to each block a char('y' for yellow,etc...) but I have a few errors:

package main;

public enum Level{ //ERROR Syntax error on token '{',@ expected after this token
    Level1 ( {{'g','g','g','g','g'},
              {'y','y','y','y','y'},
              {'b','b','b','b','b'},
              {'r','r','r','r','r'},
              {'m','m','m','m','m'}} ) //ERROR Syntax error, insert "Identifier" to complete EnumConstant
    ;

    private final char[][] levelCode;

    private Level(char[][] levelCode){
        this.levelCode=levelCode;
    }       
}
Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
  • I'd start with a simple enum example/tutorial and make sure you can get that working and understand how it's working. – blm Nov 07 '15 at 02:47
  • You can't use the direct `{}` array initialization syntax outside the context of a variable declaration. Use `new char[][] {...}`. – Sotirios Delimanolis Nov 07 '15 at 02:50

0 Answers0