Results 1 to 5 of 5
Thread: Struggling with enum!
- 09-03-2010, 11:31 AM #1
Member
- Join Date
- Aug 2010
- Posts
- 35
- Rep Power
- 0
Struggling with enum!
I feel a little silly posting about something as simple as an enum .. but I just can't get the syntax right!
All I'm trying to do is:
This has the same syntax as examples I've seen posted on the web, but the compiler says ',', '}', or ';' expected.Java Code:public final enum DeltaEnum { POSITIVE = 1, NEGATIVE = -1; }
Confused! :confused:
(And a little embarrassed :o ... !)
-
If you see a web example of a Java 1.5 or above enum showing code like that, I'd like to see the website, because you're code is very wrong (= 1?) and you must be looking at bad examples. Please go to the Sun/Oracle tutorials and study those pages: enum tutorial
Best of luck.
- 09-03-2010, 12:14 PM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
That looks (sort of, if you squint) like C++ enums, where you can assign numeric values to them.
But yes, that's not Java syntax.
- 09-03-2010, 12:19 PM #4
Member
- Join Date
- Aug 2010
- Posts
- 35
- Rep Power
- 0
Thanks for the link, I've fixed it using (1) and (-1) instead of =1 and =-1.
FYI, the site I was looking at was: Java enum example
- 09-03-2010, 12:23 PM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Similar Threads
-
Struggling with AlphaComposite .. please help me
By jeshmal4u in forum Java 2DReplies: 3Last Post: 03-08-2010, 05:11 AM -
enum
By billq in forum New To JavaReplies: 3Last Post: 01-03-2010, 08:38 PM -
Struggling with OnKeyPressed Event in java
By Camzie in forum NetBeansReplies: 2Last Post: 12-01-2009, 07:58 AM -
Struggling with java .ini files
By Camzie in forum NetBeansReplies: 6Last Post: 11-24-2009, 03:13 PM -
struggling with creating a GUI
By tuwannu in forum Advanced JavaReplies: 2Last Post: 12-01-2008, 02:53 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks