logo

Crowdly

Browser

Add to Chrome

Яким буде результат роботи наступного коду? public abstract class SomeClass i...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Яким буде результат роботи наступного коду?

public abstract class SomeClass implements Runnable {

private Object lock = new Object ();

public void lock () {

synchronized (lock) {

try {

lock.wait ();

System.out.print ( "1");

} Catch (InterruptedException e) { }

}

}

public void unlock () {

synchronized (lock) {

lock.notify ();

System.out.print ( "2");

}

}

public static void main (String s []) {

new Thread (new SomeClass () {

public void run () {

lock ();

}

}). Start ();

new Thread (new SomeClass () {

public void run () {

unlock ();

}

}). Start ();

}

}

(Java)

0%
0%
0%
50%
0%
More questions like this

Want instant access to all verified answers on moodle.chnu.edu.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome