Skip to main content

How do you create and start a thread?

Junior Java
Quick Answer Two ways to create threads: extend Thread class and override run(), or implement Runnable interface and pass to Thread constructor. Prefer Runnable - it doesn't waste your single inheritance. Java 8+: use lambdas: new Thread(() -> doWork()).start(). Better yet, use ExecutorService to manage thread pools instead of creating threads manually.

Answer

Extend Thread or implement Runnable.
Call start() to run thread asynchronously.
Thread pools manage multiple threads efficiently.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice