Dear Ranch People
First off, please forgive me, should the following be a recurring question. But I spent several hours today in order to work out what I don't understand and I couldn't find a satisfying clue so far. My question concerns enumerate types and the optional semicolon.
Sierra/Bates
SCJP Study Guide for
Java 5.0 (I bought my copy in June 2007) says on page 62: ... made it optional to put a semicolon at the end of the enum declaration, when no other declarations for this enum follow:
I'm about to loose my way because of "when [reads 'if'] no other declarations for this enum follow". Shouldn't this read "where [or because] no other declarations for this enum follow". Since the semicolon is already outside the curly brackets that define the body of the enumerated type declaration, how can any piece of code be assigned to CoffeeSize? (I ought to say, that I'm somtimes uncertain wether "enum" means "enumerated type" or "an element of the enumerated type".) Due to the recent errata list for the Study Guide, the above statement is correct; see
https://coderanch.com/t/257589/java-programmer-SCJP/certification/SCJP-Errata-Updated Could I ask you for an example, where the semicolon in
is mandatory because "other declarations for this enum follow"? From my point of view, the constant-specific-class-body-code on page 65 is not(!) what I need, since the semicolon there separates the list of constant values from the constructor "CoffeeSize(int ounces) {...}" and what comes after that.
Best regards,
Ralf
[ March 24, 2008: Message edited by: Ralf Wahner ]
[ March 24, 2008: Message edited by: Ralf Wahner ]
[ March 24, 2008: Message edited by: Ralf Wahner ]