In Java, the concept of multiple inheritance is possible only through the interface. The interface is a collection of abstracts method (normal method not present). Unless the class that implements the interface is abstract, all the method of the interface needs to be defined in the class. A class implements an interface using the keyword implements.

Runnable interface in Java

The java.lang.Runnable is the interface that is to be implemented by the class whose instances are intended to be executed by a thread. There are two ways to start a new Thread – Subclass Thread and implements the Runnable interface. There is no need for subclassing Thread when the task can be done by overriding only run() method of Runnable.

See the syntax interface.

class <class_name> implements <interface_name>

#java #java.lang.runnable

Runnable Interface in Java Example | Java Runnable Interface
2.25 GEEK