Hello all. On page 65 of Bates and Sierra book there is an example enum where the getLidCode method is overloaded. There's a comment that says that <-- the semicolon is REQUIRED... I just coded something similar that seems to work without the ';'. Granted I put the overloaded enum type first (their's has it last), but I didn't put a semicolon and it worked just fine. Here's the code:
Any comments or explanations? [ November 14, 2007: Message edited by: nico dotti ]
A semi colon is required to end enum Constant declarations when you have an enum body(i.e variables, methods, Constructors), Not when you have a Constant specific class body.
And you still have to provide it in you example: SMALL(8,"Live a little why don't you!"); <-
Joined: Oct 09, 2007
Thanks Ahmed...that makes sense to me. However, I didn't quite understand you're last comment - were you basically pointing out that my example itself confirms what you're saying given the ';' at the end?
Joined: Apr 22, 2006
Yes, in your example you have an enum body, hence the semi colon is required.
subject: Interesting exception to overloading enum rule from Sierra Bates book