This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Q on Threads. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Q on Threads." Watch "Q on Threads." New topic

Q on Threads.

vadiraj vd
Ranch Hand

Joined: Dec 15, 2000
Posts: 68
Hi All,
This question is from Mughal's mock exam. Could anyone give me an answer with explaination ?

Given the following code, which statements concerning
the objects referenced through the member variables
i, j and k are true, given that any thread may call
the methods a, b and c at any time?
class Counter {
int v = 0;
synchronized void inc() { v++; }
synchronized void dec() { v--; }
public class Q7ed5 {
Counter i;
Counter j;
Counter k;
public synchronized void a() {;
public synchronized void b() {;;;
i.dec(); j.dec(); k.dec();
public void c() {;



There's a lot of I in J.

Regards<BR>---------<BR>vadiraj<P><BR>*****************<BR>There's a lot of I in J.<BR>*****************
nan sh
Ranch Hand

Joined: Jan 05, 2001
Posts: 167

Have you tried this Mock Exam Testing Engine yet?<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Q on Threads.
Similar Threads
Khalid's Question
One more on threads
Mughal rasmussen question
Thread Question from Khalid book!
Thread Question