Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Report the deterministic output or all possible outputs that can be generated by the program HW_1_2_SP19 reported below. Justify your answer, by describing your motivations

image text in transcribed
image text in transcribed
Report the deterministic output or all possible outputs that can be generated by the program "HW_1_2_SP19" reported below. Justify your answer, by describing your motivations in terms of multi-threading issues. You can also show a thread diagram. 3 public class HW_1_2_SP19 { 5 private static int x - ; public static void main(String[] args) throws InterruptedException { MyThread ti - new MyThread("t1"); MyThread t2 - new MyThread("t2"); method10; t1.start(); t1.join(; method2O; t2.start(); t2.join(); method10: } //main public static void method1() { X++; Thread t1 - Thread.currentThreado; System.out.println("X" + x + " Name=" + t1, getName() + " State-" + t1.getState(); }//method1 public static void method2() { Thread t2 = Thread.currentThreado; System.out.println("X-" + x + " Name=" + t2.getName() + " State" + t2.getState(): SEX ++; }//method2 31 }//HW_1_2_5P19 33 class MyThread extends Thread { 34 int x; 35 public MyThread(String Name) { 36 setName(Name); }//constructor 39 public void run() { System.out.println("X- X++ }//run 43 }//My Thread + getName() + " State-" + getState()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions