FAQ Part 8: Multithreading and Concurrency

What is multithreading?

Multithreading allows multiple parts of a program to run concurrently. Java provides Thread and Runnable for creating threads.

class MyThread extends Thread {
  public void run() {
    System.out.println("Running");
  }
}

What are the states of a thread?

  • New
  • Runnable
  • Running
  • Blocked/Waiting
  • Terminated