PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Java · Theory

How to Create Thread in Java?

← All stacks

Theory

109/270

How to Create Thread in Java?

Two common ways. 1) Extend Thread and override run(), then t.start(). 2) Implement Runnable and pass it to new Thread(r).start(). Prefer Runnable — your class can still extend something else.

Work goes in run(). start() asks the JVM to schedule a new thread. If you call run() yourself, it runs on the same thread — no parallelism.

lambda — new Thread(() -> System.out.println("hi")).start();

Let's take this on the board with one tiny Main class — no extra files. How to Create Thread in Java? — start() schedules the thread; main also prints — order may vary. Start from main, go line by line, and stop at each print. That output is the proof for How to Create Thread ?.

Exam tip

Two ways: extend Thread or implement Runnable. Always start(), never run() for a new thread.

Example

// Thread demo
public class Main {
  public static void main(String[] args) {
    Thread t = new Thread(() -> System.out.println("Hi from thread"));
    t.start();
    System.out.println("Hi from main");
  }
}

How to Create Thread in Java? — start() schedules the thread; main also prints — order may vary.

Short notes

  • DefCreate with extends Thread or implements Runnable, then start().
  • RulePrefer Runnable. Work in run(). Start with start().
  • TrapCalling run() instead of start().
  • Usenew Thread(() -> ...).start();

Questions

1

Two ways to create a thread?

2

start vs run?

Previous← Thread Life Cycle in JavaNextThread Scheduler in Java →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.