Why does Java have two ways to create child threads?

Why does Java have two ways to create child threads? Which way is better?

Java threads can be created graciously in two ways: implementing the Runnable interface and extending Thread class.

Extending the class inherits the methods and data members, fields from the class Tread. In this process only one class can be inherited from the parent class Thread.

Implementing Runnable interface overcomes the limitation of inheriting from only one parent class Thread. Using Runnable interface, lays a path to ground work of a class that utilizes threads. The advantage is a class can extend Thread class and also implements the Runnable interface, if required. The Runnable interface is set for implementing a thread and the class that implements the interface performs all the work.
Tips on effectively using Multithreading - Java
In multiple processor systems, a large algorithm will split the process into threads. So that different processors can handle different threads...
Enumerations vs final variables in java
Enumeration is type safe. Where as final variables are not. Enumeration supports to have a blend of various values. Where as final variables does not support multiple values...
Output to an applet’s window - Java
Yes it is possible for a method other than paint() or update() to output an applet’s window. It is mandatory to obtain a graphics context by invoking getGraphics() method...
Post your comment