What is the Thread class in Java?

Java 8Object Oriented ProgrammingProgramming

The java.lang.Thread class is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently. Following are the important points about Thread −

  1. Every thread has a priority. Threads with higher priority are executed in preference to threads with lower priority.
  2. Each thread may or may not also be marked as a daemon.

There are two ways to create a new thread of execution.

  1. One is to declare a class to be a subclass of Thread.
  2. Another way to create a thread is to declare a class that implements the Runnable interface.
raja
Published on 08-Feb-2018 13:56:49
Advertisements