• Post Reply Bookmark Topic Watch Topic
  • New Topic

Enumeration in JDK 1.4.2  RSS feed

 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to use the functionality of Enumeration and we are using JDK 1.4.2. Is there is any way to do it? I know that JDK 1.5 supports Enumeration.
Any help is appreciated.
regards
sudha
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Enumeration" is an interface that has existed since before Java 1.0. "enum" is a new keyword in Java 5. Which are you talking about?
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for the info.
Basically i wanted this functionality in jdk1.4

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

regards
sudha
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before Java 5, generally people used static final variables in place of an enum. You can define a special class, put the constants in it, give it a private constructor, and use instances of that class to represent the enum members; this has a name, the "typesafe enum pattern." Here's a web page that discusses how to do it.
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks alot for the info
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also check out this thread, just started yesterday.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!