| Author |
Can we use Enum as a variable name in jdk1.4
|
sumanta panda
Ranch Hand
Joined: Jun 23, 2008
Posts: 224
|
|
Dear All,
Enum is a keyword in jdk 1.5.So we cannt use the varibale name enum in jdk 1.5.
Can we use enum as a variable name in jdk 1.4?
Please suggest.
Thanks in advance.
Regards
Sumanta Panda
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Have you tried it?
But let me answer that for you: yes you can, but you shouldn't. It will work just fine in the Java 1.4 code, but if you decide to migrate to Java 5.0 or Java 6 later your code will be broken. By thinking ahead and choosing different names you can prevent that.
The same holds for "assert" between Java 1.3 and Java 1.4.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
You might be interested in this
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html
Moving to a more appropriate forum.
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
|
Actually Enum isn't a keyword; enum is.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
|
And there is a risk of confusion between Enum and Enum.
|
 |
sumanta panda
Ranch Hand
Joined: Jun 23, 2008
Posts: 224
|
|
|
Thanks a lot to all of you.
|
 |
 |
|
|
subject: Can we use Enum as a variable name in jdk1.4
|
|
|