Re: Is there a limit to the number of "things" in an enum




<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 {
"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";
}
enum 8onstants are names, not strings.
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


.



Relevant Pages

  • Re: Access awake after 7 years?
    ... The implication that simple applications don't have problems ... > programming problems in Access VBA. ... Yes, and ENUM is an easy way to do that, but it can be ... But that's a case where the inadequacies of the IDE have trained us ...
    (comp.databases.ms-access)
  • Re: Visual C++ 6 support issue
    ... >> A common IDE is a good idea, but usually in programming, you have ... >would do what made sense for that language. ... >or at least for allocating resource ID values within specified ranges. ... >That is, for example, I'd like to keep all the help strings and all the ...
    (microsoft.public.vc.mfc)
  • Re: Visual C++ 6 support issue
    ... > A common IDE is a good idea, but usually in programming, you have ... or at least for allocating resource ID values within specified ranges. ... That is, for example, I'd like to keep all the help strings and all the ...
    (microsoft.public.vc.mfc)
  • Re: enum
    ... >I have an enum type with as much as 70 values. ... Is there a better and more elegant solution? ... >and would feed it to a good data structure, ... the strings in the function, but you could alternatively define the ...
    (alt.comp.lang.learn.c-cpp)
  • Re: enumerated static string table
    ... The strings will be of widely ... > (enum name,string) to maintain. ... I was briefly thrown off by the missing semicolon on the declaration ... an input file; the input file might look like this: ...
    (comp.lang.c)