• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to learn enumerated types of class

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m trying to learn enumerated types of class , but when i was compiling it produced an error , i cant solve this please tell me whats wrong




 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be public class TestProgram. That solves all but one compiler error.
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:It should be public class TestProgram. That solves all but one compiler error.

what is the actual use of doing this , i mean we can do this without enum also , so why we need enum ???
 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you create a type, that type must be an interface, a class or an enum. You must specify which of the three; the enum keyword simply replaces the class keyword in the type declaration.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic