Bookmark Topic Watch Topic
  • New Topic

How use Enum in java 6.o  RSS feed

 
Alix Sye
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am not able to use enum in java 6.0. The following is the code but it gives error. please any body can guide me why it is giving error.
The error is enum is a keyword and not be used as identifier....Any body can help me why is this error

public class EnumTest {

public enum MainMenu {FILE, EDIT, FORMAT, VIEW};

public static void main(String[] argv) {

for (MainMenu menu : MainMenu.values())
{ System.out.println(menu); }



}
}
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!