What happened to Enum?

R

Rhino

I'm just starting to get back into Java after an extended absence of about 3
years working on other things and I'm bumping into some things that have me
confused.

I've installed Eclipse 3.5.1 and the 1.6 level version of the JDK. When I
try to create an Enum, I get strange messages from Eclipse. I'm getting the
impression that Enums, which were new in JDK 1.4 if I recall correctly, are
now gone: is that right?

Can someone fill me in on what happened to them? I was just starting to use
these routinely when I detoured into other things so I suspect I've missed
some major developments in Java. If Enums are indeed gone, what is the "new
and better way" to accomplish the same thing?
 
L

Lew

Rhino said:
I've installed Eclipse 3.5.1 and the 1.6 level version of the JDK. When I
try to create an Enum, I get strange messages from Eclipse. I'm getting the

Post code and the "strange" messages, copied and pasted, not
paraphrased. We can then explain them. I'm guessing you tried to use
the 'Enum' class directly instead of the 'enum' keyword.
impression that Enums, which were new in JDK 1.4 if I recall correctly, are
now gone: is that right?

No, it isn't.

Enums were new in Java 5, not 1.4.

The tutorial covers them in
<http://java.sun.com/docs/books/tutorial/java/javaOO/enum.html>

Enums are declared using the keyword 'enum'.

public enum RGB
{
RED, GREEN, BLUE;
}

Before concluding that enums "are now gone", you should read the
documentation. For fundamental questions, I usually start with the
tutorials before moving on to advanced literature or newsgroups.

The JLS covers them in excruciating detail in
<http://java.sun.com/docs/books/jls/third_edition/html/
classes.html#8.9>

Also, GIYF.
 
A

Arne Vajhøj

Rhino said:
I'm just starting to get back into Java after an extended absence of about 3
years working on other things and I'm bumping into some things that have me
confused.

I've installed Eclipse 3.5.1 and the 1.6 level version of the JDK. When I
try to create an Enum, I get strange messages from Eclipse. I'm getting the
impression that Enums, which were new in JDK 1.4 if I recall correctly, are
now gone: is that right?

Can someone fill me in on what happened to them? I was just starting to use
these routinely when I detoured into other things so I suspect I've missed
some major developments in Java. If Enums are indeed gone, what is the "new
and better way" to accomplish the same thing?

Enums has not been removed from Java.

Try post the code you are trying to compile and the error message
you get, then hopefully someone can tell you what the problem is.

Arne
 
R

Roedy Green

which were new in JDK 1.4 if I recall correctly, are
now gone: is that right?

There are alive and well. See http://mindprod.com/jgloss/enum.html

You might have the compiler configured in your IDE to some old
version.
--
Roedy Green Canadian Mind Products
http://mindprod.com

I advocate that super programmers who can juggle vastly more complex balls than average guys can, should be banned, by management, from dragging the average crowd into system complexity zones where the whole team will start to drown.
~ Jan V.
 
R

Roedy Green

I'm just starting to get back into Java after an extended absence of about 3
years working on other things and I'm bumping into some things that have me
confused.

I've installed Eclipse 3.5.1 and the 1.6 level version of the JDK. When I
try to create an Enum, I get strange messages from Eclipse. I'm getting the
impression that Enums, which were new in JDK 1.4 if I recall correctly, are
now gone: is that right?

Can someone fill me in on what happened to them? I was just starting to use
these routinely when I detoured into other things so I suspect I've missed
some major developments in Java. If Enums are indeed gone, what is the "new
and better way" to accomplish the same thing?

Note, the keyword is enum not Enum. It is implemented under the hood
by extending the Enum class.
--
Roedy Green Canadian Mind Products
http://mindprod.com

I advocate that super programmers who can juggle vastly more complex balls than average guys can, should be banned, by management, from dragging the average crowd into system complexity zones where the whole team will start to drown.
~ Jan V.
 
D

Dave Searles

Peter said:
[...]
I've installed Eclipse 3.5.1 and the 1.6 level version of the JDK. When I
try to create an Enum, I get strange messages from Eclipse.

Such as?
I'm getting the
impression that Enums, which were new in JDK 1.4 if I recall
correctly, are
now gone: is that right?

No, that's not right. Are you sure your project in Eclipse is properly
configured to target Java 1.6, rather than some earlier version? It's
hard to imagine you'd have it configured for pre-1.4, but based on the
limited information you've provided so far, that's the only thing that
comes to mind.

Of course, part of the problem is that you're very unspecific about what
problem you're actually seeing. I suppose it's possible you've just
forgotten how to use enums in Java properly, and the errors you're
getting are just plain old syntax errors of some sort.

No. None of the nasty things that you have said or implied about Rhino
are true.




Just kidding. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top