Tao
Tao
Home avatar

Exploring technology and life's wisdom

Ways to Create Threads in Java

This article explores the ways to create threads in Java based on JDK 11. My answer is that there are only two ways: extending the Thread class and implementing the Runnable interface, as stated in the Oracle official documentation. Thread ClassThe Thread class is provided by Java to represent a thread. It is a concrete class that implements the Runnable interface and offers additional thread control and management functionalities. By extending the Thread class, you can create custom thread classes.