This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Dumb question about threads #2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Dumb question about threads #2" Watch "Dumb question about threads #2" New topic

Dumb question about threads #2

Max Bazhenov

Joined: Oct 30, 2004
Posts: 18
Given the following code, which statements are true?

A. The code will fail to compile.
B. Separate threads can execute the up() method concurrently.
C. Separate threads can execute the down() method concurrently.
D. Separate threads can execute both the up() and down() method concurrently.
E. The assertion in the jump() method will not fail under any circumstances.

Why D is correct ?
And why E is incorrect ?

(code tags added)
[ November 12, 2004: Message edited by: Barry Gaunt ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
recent discussion

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Consider Paul's rocket mass heater.
subject: Dumb question about threads #2
Similar Threads
Thread :(
Thread question with sync
synchronisation problem
mock question from khalid Moughal