File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads Chapter Question 15: yo yo dude dude program.

 
jose chiramal
Ranch Hand
Posts: 266
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic