which class define thread in Java code example
Example 1: java thread
public class ClassName extends Thread{
public void run(){
super.run();
}
}
public class Main{
public static void main(String[] args){
ClassName thread = new ClassName();
thread.start();
}
}
Example 2: creating thread in java example
class Multi3 implements Runnable{
public void run(){
System.out.println("thread is running...");
}
public static void main(String args[]){
Multi3 m1=new Multi3();
Thread t1 =new Thread(m1);
t1.start();
}
}