This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Java program unexpectedly giving different results each time it is run Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Java program unexpectedly giving different results each time it is run" Watch "Java program unexpectedly giving different results each time it is run" New topic
Author

Java program unexpectedly giving different results each time it is run

Ashish Ramteke
Ranch Hand

Joined: Oct 24, 2012
Posts: 88
    
    1
Hello folks! I am not getting why the Java program below is givingdifferent results each tme it is run.
I have Java 7 installed on my Windows 7 Home Basic PC. This is a code from an 'excercise' from the book, Head First Java 2nd ed..
The output should obviously be:
one 98098
two 98099

Can you figure it out?

Ashish Ramteke
Ranch Hand

Joined: Oct 24, 2012
Posts: 88
    
    1
Hi guys! I found that this issue is already resolved as far as the output is concerened in the 'Beginning Java' forum.
Here is its link:
http://www.coderanch.com/t/504869/java/java/TestThreads-Code-Magnets-exercise-Head
I found this link in the 'Similar Threads' section below...
 
Have you checked out Aspose?
 
subject: Java program unexpectedly giving different results each time it is run
 
jQuery in Action, 3rd edition