simple thread program in java

The below is the code to create simple thread in java
The below program will crate the 3 thread and run the threads

class ThreadExample1 extends Thread {
public void run() {
for (int i = 0; i < 5; i++) {
System.out.println(“I am Thrad 1”);
}
}
}

class ThreadExample2 extends Thread {
public void run() {
for (int i = 0; i < 7; i++) {
System.out.println(“I am Thrad 2”);
}
}
}

class ThreadExample3 extends Thread {
public void run() {
for (int i = 0; i < 6; i++) {
System.out.println(“I am Thrad 3”);
}
}
}

public class SimpleThreadExampe {
public static void main(String[] args) {
ThreadExample1 ObjThread1 = new ThreadExample1();
ObjThread1.start();

ThreadExample2 ObjThread2 = new ThreadExample2();
ObjThread2.start();

ThreadExample3 ObjThread3 = new ThreadExample3();
ObjThread3.start();
}
}

Output

I am Thrad 1
I am Thrad 1
I am Thrad 1
I am Thrad 1
I am Thrad 1
I am Thrad 2
I am Thrad 2
I am Thrad 2
I am Thrad 2
I am Thrad 2
I am Thrad 2
I am Thrad 2
I am Thrad 3
I am Thrad 3
I am Thrad 3
I am Thrad 3
I am Thrad 3
I am Thrad 3