Course contentsShow
← Java
Lesson 2574 of 2,87048. Concurrency FundamentalsFree lesson

Why You Should Never Call run() Directly

Calling run() executes code synchronously in the current thread, not a new one.

Why You Should Never Call run() Directly

You'll learn why calling run() on a Thread object defeats the entire purpose of multithreading.

When you call run() directly on a Thread or Runnable, you're executing the code synchronously in your current thread—not in a new, separate thread. This is one of the most common beginner mistakes in concurrent programming.

The Critical Difference

Think of it this way: start() is like hiring someone to do a job while you continue your own work. Calling run() directly is like doing their job yourself, then continuing your work afterward. No parallelism occurs.

When you call start():

  • The JVM creates a new thread of execution
  • That new thread calls the run() method
  • Your current thread continues immediately
  • Two threads now run concurrently

When you call run() directly:

  • No new thread is created
  • The run() method executes in your current thread
  • Your current thread waits for run() to complete
  • Everything happens sequentially, just like a normal method call

Example of the Mistake

Thread t = new Thread(() -> {
    System.out.println("Running in: " + Thread.currentThread().getName());
});

t.run();    // WRONG: Executes in main thread
// Output: Running in: main

t.start();  // CORRECT: Executes in new thread
// Output: Running in: Thread-0

The run() method is public only because start() needs to call it—you should never call it yourself.

Key Takeaway: Always use start() to launch a thread; calling run() directly bypasses thread creation entirely and executes the code synchronously in your current thread, eliminating any concurrency benefit.