This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Enums Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Enums" Watch "Enums" New topic


Akhil Maharaj
Ranch Hand

Joined: Sep 29, 2007
Posts: 63
Hi ,

In the following code If I don't put semicolon at the end of

EXEC(1.5,150) it is not getting compiled . Accroding to K&B page 65 example , semicolon is required when we have body.Any explanation ?

Code is here .

Kelvin Chenhao Lim
Ranch Hand

Joined: Oct 20, 2007
Posts: 513
Not sure what you're asking. That's just the syntax for defining an enum.

The semicolon is needed to denote the end of the enum value list. It's optional if you don't provide any methods or fields, but you can include it too if you want, e.g.:

SCJP 5.0
Akhil Maharaj
Ranch Hand

Joined: Sep 29, 2007
Posts: 63
I read K&B Errata for Page 62 and Page 65 . It did not make much sense to m e. After reading your post , errata for K&B - I currected myself .I think I am clear on enums now .
I agree. Here's the link:
subject: Enums
It's not a secret anymore!