This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads Chapter Question 15: yo yo dude dude program. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Threads Chapter Question 15: yo yo dude dude program." Watch "Threads Chapter Question 15: yo yo dude dude program." New topic
Author

Threads Chapter Question 15: yo yo dude dude program.

jose chiramal
Ranch Hand

Joined: Feb 12, 2010
Posts: 266

When I run this program I get output as :

yo yo dude dude

Whereas K & B book says :

the output could be yo dude dude yo

[Ankit: added code tags and fixed subject line]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

Please UseCodeTags when you post source code (you've been here for a while, you should understand by now how to use code tags...).

jose chiramal wrote:the output could be yo dude dude yo

Pay attention to the word "could". It doesn't say it's always "yo dude dude yo".

Do you understand yourself why you get the output that you do?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
Generally speaking, SCJP questions have extremely precise answers, but thread questions, by the very nature of how threads get scheduled often CANNOT have such precise answers...

So, it's really common to see imprecise words in threads questions like: "probably" or "could" or "possible" or "tends" or "most likely". Of course it's essential that you pay attention when a question uses a word like that - it means that you can't exactly predict the outcome of some code, but that you can know some things about how it will run.


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
 
 
subject: Threads Chapter Question 15: yo yo dude dude program.