The run Method vs start Method
What you'll learn: Why calling start() launches a new thread, while calling run() directly does not.
The Critical Difference
When you create a Thread object (or pass a Runnable to it), you have a choice: call run() directly or call start(). These two methods behave very differently:
-
start(): Asks the JVM to create a new thread of execution. The JVM schedules this new thread, and it eventually executes therun()method in that separate thread. This is true concurrency. -
run(): Simply calls the method like any normal method call. No new thread is created. The code executes in the current thread (usually the main thread), completely defeating the purpose of threading.
An Analogy
Think of a Thread as a worker you've hired. Calling start() is like telling the worker, "Go off and do your job independently." The worker operates on their own schedule. Calling run() directly is like saying, "Stand here while I do your job myself"—you're just executing the task in your own context.
Example Behavior
Thread t = new Thread(() -> {
System.out.println("Running in: " + Thread.currentThread().getName());
});
t.run(); // Prints "Running in: main" — no new thread!
t.start(); // Prints "Running in: Thread-0" — new thread created!
In the first case, run() executes immediately in the main thread. In the second case, start() creates a new thread that executes run() concurrently.
Why This Matters
Using run() by mistake is a common bug. Your program will still compile and run, but it won't be concurrent—everything executes sequentially, and you lose all threading benefits.
Key Takeaway: Always call start() to launch a new thread; calling run() directly bypasses concurrency entirely and executes in the current thread.