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

Java · Theory

Multithreading in Java

← All stacks

Theory

107/270

Multithreading in Java

Multithreading means one program can run several paths of work at the same time. A thread is a lightweight unit of execution inside a process. Create with a Thread subclass or Runnable, then call start().

start() asks the JVM to begin a new thread. run() is only the work body. If you call run() yourself, no new thread is scheduled — that is the classic trap. Why threads: keep a server responsive, do background work, use more than one core.

Shared data needs care (synchronization) or results become wrong. Interview line: thread = path of execution; start vs run; shared data needs sync.

Let's take this on the board with one tiny Main class — no extra files. Multithreading 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 Multithreading.

Diagram
main
    │ start()
    ▼
  worker → run()
    │
    └── join() waits
Exam tip

start() vs run() is a classic trap question.

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");
  }
}

Multithreading in Java — start() schedules the thread; main also prints — order may vary.

Short notes

  • DefMultithreading = several paths of work overlapping in one program.
  • RuleCreate Thread/Runnable, then start(). run() is only the work body.
  • TrapCalling run() does not start a new thread.
  • RememberShared data needs synchronization.

Questions

1

What is a thread?

2

start() vs run()?

3

Why synchronize?

Previous← Java Nested InterfaceNextThread Life Cycle 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.