Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in K&B SCJP 5: topic enum declaration

 
Chris Goad
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pages 76 and 79. The answer to question 8 indicates that it compiles and gives output without any error, but Line 5 does not have a semicolon.

On page 65, the code example indicates that 'the semicolon is REQUIRED when you have a body'

Which is correct? These seem to contradict.

Thanks,
Chris
 
Chris Goad
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How's this :-) Sorry, I had not read that little snippet.

Chris
 
Chris Goad
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With the exception of correcting my sign in name, has anyone had a chance to look at this one? As noted before, these seems contradictory.

Thanks for any help.

Chris
 
Henry Wong
author
Marshal
Pie
Posts: 21378
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may help if you provided an excerpt. As written, you are limited to only people who has a copy of the book.

Henry
[ August 15, 2006: Message edited by: Henry Wong ]
 
Bert Bates
author
Sheriff
Posts: 8900
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Chris,

In general on JavaRanch, it's acceptable to post code snippets from a book or a mock exam for the purposes of discussion. What the authors of the material like to see is an acknowledgment of the source of the code snippet. So you might say: "This is from Whiz-labs...."

hth,

Bert

p.s. BTW, I'm not being obtuse here (wow - I've used "obtuse" twice in the same morning ), Kathy and I have a personal policy that we like ranchers to hash out technical questions before we do; it gives everyone additional "learning opportunities"
 
Mandeep kaur
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
i think you have some confusion,i have checked from book.when author says that code block must end with semicolon he is talking about code block that defines body of constant,not body of enum.and in question no 8,line 5 ,there should be no semicolon as body of enum is ending there
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic