beginnerMultithreading Basics
What are the different states in a Java thread's lifecycle?
NEW (created but not started), RUNNABLE (executing or ready to execute — the JVM doesn't distinguish 'running' from 'ready' as a separate state), BLOCKED (waiting to acquire a lock), WAITING (waiting indefinitely for another thread's signal, e.g. via join() or wait()), TIMED_WAITING (waiting with a timeout, e.g. sleep(ms)), and TERMINATED (finished execution). Thread.getState() returns exactly one of these six values at any point.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response