How are java threads created?

Java

1 answer

Answer

1097434

2026-05-21 18:45

+ Follow

Java
Java

Thread can be created in two ways either by extending Thread or implementing runnable interface

Examples:

public class A extends Thread { } public class A implements Runnable { } By using both the methods we can create a Java Thread. The disadvantage of extending the Thread class is that, you cannot extend the features of any other class. If we extend the Thread class we cannot extend any other class whose features we may require in this class.

So it is usually advisable to implement the Runnable Interface so that we can extend the required features and at the same time use the Thread functionality.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.