aspose file tools
The moose likes Java in General and the fly likes Can we use Enum as a variable name in jdk1.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Can we use Enum as a variable name in jdk1.4" Watch "Can we use Enum as a variable name in jdk1.4" New topic
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
    
    4
Actually Enum isn't a keyword; enum is.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32689
    
    4
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Can we use Enum as a variable name in jdk1.4
 
Similar Threads
Enum example
Switch question??
Tomcat : error on token "enum" ?
Is there anything developed in java 4 and not run in java 5?
static import