Reputation: 145
I just learned about enums and am a bit confused. I want to declare my enums all in one File I found this question and for all I can see did exactly that
Multiple Enum Classes in one Java File
only that it does not work
public class DERstring{
public enum Fertigkeit
{
UEBER = "Überreden";
HEIML = "Heimlichkeit";
SUCHE = "Suchen";
}
public enum Terrain
{
LEICHT = "leicht";
MITTEL = "mittelschwer";
UNPASS = "unpassierbar";
}
}
for each inner ennum class eclipse gives me the Error "insert 'EnumBody to complete ClassBodyDeclaration. What is it I'm doing wrong here?
Upvotes: 0
Views: 2871
Reputation: 314
You have incorrect syntax. Try something like this:
public class DERstring{
public enum Fertigkeit
{
UEBER("Überreden"),
HEIML("Heimlichkeit"),
SUCHE("Suchen");
private String name;
private Fertigkeit(String name){
this.name=name;
}
public String getName() {
return name;
}
}
.....other enums classes...
}
Upvotes: 1