Question 1: Write a program to print "Good morning" and "Welcome" continuously on the screen in Java using threads.
Answer 1:
Question 2: Add a step method in the welcome thread of question 1 to delay its execution for 200ms.
Answer 2:
Question 3: Demonstrate gerPriority() and setPriority() methods in Java threads.
Answer 3:
Question 4: How do you get the state of a given thread in Java?
Answer 4: getState() method is used to get the state of a given thread in Java.
Question 5: How do you get the reference to the current thread in Java?
Answer 5: currentThread() method is used to reference the current thread in Java.
No comments:
Post a Comment