This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question 15 chapter 9 of k&B Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question 15 chapter 9 of k&B" Watch "Question 15 chapter 9 of k&B" New topic
Author

Question 15 chapter 9 of k&B

Mauricio Archbold Babroza
Greenhorn

Joined: Apr 01, 2009
Posts: 11

And given these two fragments:
I. synchronized void chat(long id) {
II. void chat(long id) {
When fragment I or fragment II is inserted at line 5, which are true? (Choose all that apply.)
A. An exception is thrown at runtime
B. With fragment I, compilation fails
C. With fragment II, compilation fails
D. With fragment I, the output could be yo dude dude yo
E. With fragment I, the output could be dude dude yo yo
F. With fragment II, the output could be yo dude dude yo

when i run the programa the output with the two fragments is the same yo yo dude dude but the answer in the book is the F, ??
I can not understand why?
and if the real answer is de f ,why the d could not be too?
sorry for my english jeje
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9307
    
  17

Mauricio, this question has been asked many times before like here, here and here. See if any explanation from those topics can help you out...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question 15 chapter 9 of k&B