Q5. How do you create a thread in Java? <h3>
In answering this Java multithreading interview question, remember that there are two common ways of creating a thread:
1. Extending the Thread class:
class MyThread extends Thread { public void run() { System.out.println("Thread running..."); } } public class Main { public static void main(String[] args) { MyThread t1 = new MyThread(); t1.start(); } }