In the above program, we created two classes MyThread and Main. We created MyThread class by implementing the Runnable interface.
The Main class contains a main() method. The main() method is the entry point for the program. Here we created the three threads and got the priorities of threads using the getPriority() method and printed the result.
Program/Source Code:
The source code to get thread priority is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we created two classes MyThread and Main. We created MyThread class by implementing the Runnable interface.
The Main class contains a main() method. The main() method is the entry point for the program. Here we created the three threads and got the priorities of threads using the getPriority() method and printed the result.