Java : Thread - Exercises and Solution


1. Write a Java program to create a thread by extending the Thread class

View Solution

2. Write a Java program to get the state of the currently executing thread

View Solution

3. Write a Java program to check thread is alive or not

View Solution

4. Write a Java program to suspend a thread

View Solution

5. Write a Java program to create a thread by implementing a Runnable interface

View Solution

6. Write a Java program to set and print thread name

View Solution

7. Write a Java program to print the thread Id of a thread

View Solution

8. Write a Java program to suspend and resume a thread

View Solution

9. Write a Java program to stop a thread

View Solution

10. Write a Java program to create multiple threads

View Solution

11. Write a Java program to demonstrate the Thread.join() method

View Solution

12. Write a Java program to sleep a thread

View Solution

13. Write a Java program to interrupt the execution of a thread

View Solution

14. Write a Java program to set a thread name using the setName() method

View Solution

15. Write a Java program to create a group of a thread

View Solution

16. Write a Java program to get thread priority

View Solution

17. Write a Java program to set thread priority

View Solution

18. Write a Java program to count active threads of a thread group

View Solution

19. Write a Java program to destroy a thread group

View Solution

20. Write a Java program to get information of the current executing thread

View Solution



Basic Programs