Re: Is there a limit to the number of "things" in an enum
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Wed, 21 Mar 2007 11:08:26 -0400
<printdude1968@xxxxxxxxx> wrote in message
news:1173922615.768861.7090@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mar 14, 10:57 am, Hendrik Maryns <hendrik_mar...@xxxxxxxxxxxxx>
wrote:
printdude1...@xxxxxxxxx schreef:
On Mar 13, 2:08 pm, Roedy Green <see_webs...@xxxxxxxxxxxxxxxxxxxx>
wrote:
On Sat, 10 Mar 2007 22:44:12 GMT, JohnT <printdude1...@xxxxxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :
public enum BoardPosition {enum 8onstants are names, not strings.
"QR","QK","QB","Q","K","KK","KB","KR",
"QRP1","QKP1","QBP1","QP1","KP1","KKP1","KBP1","KRP1",
"QRP2","QKP2","QBP2","QP2","KP2","KKP2","KBP2","KRP2",
"QRP3","QKP3","QBP3","QP3","KP3","KKP3","KBP3","KRP3",
"QRP4","QKP4","QBP","QP4","KP4","KKP4","KBP4","KRP4",
"QRP5","QKP5","QBP5","QP5","KP5","KKP5","KBP5","KRP5",
"QRP6","QKP6","QBP6",*"QP6"*,"KP6","KKP6","KBP6","KRP6",
"QRP7","QKP7","QBP7","QP7","KP7","KKP7","KBP7","KRP7";
}
Seehttp://mindprod.com/jgloss/enum.html
for examples.
So the quotation marks aren't necessary? But my IDE didn't complain
about them so what does that mean?
That you have a bad IDE?
I am using Eclipse 3.2 as my IDE and jdk1.6. Maybe I will try to
compile it outside of the IDE and see what happens.
Eclipse *IS* giving you an error message... it's just that the error
message isn't as clear as it could be. You should be seeing something like
"Syntax error, insert 'EnumBody' to complete EnumDeclaration". So do what
it says and add an EnumBody:
public enum BoardPosition {
"QR", "QK", "QB", "Q";
public void someMethodWhichDoesNothing() {
}
}
Now it gives a different error message: "Syntax error on tokens,
delete these tokens", highlighting your "QR", "QK", etc. thus telling you
that your String literals are illegal.
- Oliver
.
- References:
- Is there a limit to the number of "things" in an enum
- From: JohnT
- Re: Is there a limit to the number of "things" in an enum
- From: Roedy Green
- Re: Is there a limit to the number of "things" in an enum
- From: printdude1968@xxxxxxxxx
- Re: Is there a limit to the number of "things" in an enum
- From: Hendrik Maryns
- Re: Is there a limit to the number of "things" in an enum
- From: printdude1968@xxxxxxxxx
- Is there a limit to the number of "things" in an enum
- Prev by Date: Re: Simple Calendar/ Prepared Statement question...hopefully
- Next by Date: Re: Java background image question modified
- Previous by thread: Re: Is there a limit to the number of "things" in an enum
- Next by thread: Re: Is there a limit to the number of "things" in an enum
- Index(es):
Relevant Pages
|