C
Colin
I'm just starting to teach myself Java, and I'm having a terrible time
setting up a simple enum. I'm 99.9% sure the syntax is correct,
because I've checked it with numerous online tutorials, but I still
get errors. Here is my file:
Player.java:
package my.game;
public class Player {
public enum Controller {HUMAN, COMPUTER}
private String name;
private boolean isHuman; //I want to change this to be of type
Controller
private int money;
}
and my errors, all on the line with the enum, are
enum cannot be resolved to a type
Syntax error on token "~", ReferenceType expected (in Eclipse, this
error focuses on H in HUMAN)
Syntax error, insert ";" to complete BlockStatements
Syntax error, insert ";" to complete ClassBodyDeclarations
and the warning
'enum' should not be used as an identifier, since it is a reserved
keyword from source level 5.0 on
Thanks for you help,
Colin
setting up a simple enum. I'm 99.9% sure the syntax is correct,
because I've checked it with numerous online tutorials, but I still
get errors. Here is my file:
Player.java:
package my.game;
public class Player {
public enum Controller {HUMAN, COMPUTER}
private String name;
private boolean isHuman; //I want to change this to be of type
Controller
private int money;
}
and my errors, all on the line with the enum, are
enum cannot be resolved to a type
Syntax error on token "~", ReferenceType expected (in Eclipse, this
error focuses on H in HUMAN)
Syntax error, insert ";" to complete BlockStatements
Syntax error, insert ";" to complete ClassBodyDeclarations
and the warning
'enum' should not be used as an identifier, since it is a reserved
keyword from source level 5.0 on
Thanks for you help,
Colin