class MyThreada extends Thread {
public void run() {
while (true) {
try {
System.out.println("Good Morning");
sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
class MyThreadb extends Thread {
public void run() {
while (true) {
try {
System.out.println("Hello");
sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
class MyThreadc extends Thread {
public void run() {
while (true) {
try {
System.out.println("Welcome");
sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
public class MultiThread {
public static void main(String[] args) {
MyThreada threadA = new MyThreada();
MyThreadb threadB = new MyThreadb();
MyThreadc threadC = new MyThreadc();
threadA.start();
threadB.start();
threadC.start();
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: