• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enums

 
Akhil Maharaj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 513
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.:

 
Akhil Maharaj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic