extend or inherit from a single parent class. The Thread class is defi ned in the package java.
lang . The Thread class has a number of methods, a class can use, but the most important method
is the run method which must be overridden to make the thread running. Thus, run() is the code
that will be executed ‘simultaneously’ with the other threads in a program. Its simple syntax is as
follows:
public void run()
{
..............
..............
}
2. The second method is to implement Runnable interface, which is the frequently used method
for implementing threads in the programs. The interface has just one method ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.