Multiple Enum Classes in One Java File 2 -


i learned enums , bit confused. want declare enums in 1 file found question , can see did

multiple enum classes in 1 java file

only 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 error "insert 'enumbody complete classbodydeclaration. i'm doing wrong here?

you have incorrect syntax. try 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... 

}


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -