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;
    }       
}
2
  • I'd start with a simple enum example/tutorial and make sure you can get that working and understand how it's working. Commented Nov 7, 2015 at 2:47
  • You can't use the direct {} array initialization syntax outside the context of a variable declaration. Use new char[][] {...}. Commented Nov 7, 2015 at 2:50

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.