logo

Crowdly

Browser

Add to Chrome

Результат компіляції програмного коду: public class NewThreadThree implem...

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

Результат

компіляції програмного коду:

public class NewThreadThree implements Runnable {

       String name;

       Thread t;

      

       NewThreadThree (String і){

             name = і;

             t = new Thread (this, name);

             t.start();

       }

 

       public void run() {

             try {

                    System.out.println("Виконання потоку "+ name);

                          Thread.sleep(200);

             }catch (InterruptedException e) {

                    System.out

.println(name + "

перервано");

             }

             System.out

.println(name + "

завершено");

       }

}

 

public class NewThreadThreeMain {

 

       public static void main(String[] args) {

             NewThreadThree o1 = new NewThreadThree("Один");

             System.out.println("Стан потоку виконання " + o1.t.isAlive());

            

             try {

                    o1.t.join();

             } catch (InterruptedException e) {

                    System.out.println("Головний потік перервано");

             }

             System.out.println("Стан першого потоку виконання " + o1.t.isAlive());

             System.out.println("Головний потік завершено");

       }

}

0%
0%
0%
More questions like this

Want instant access to all verified answers on virt.ldubgd.edu.ua?

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

Browser

Add to Chrome