WAP to create multiple threads (extending thread class)

3 years ago
OOP Java

package extendingthreadcalss;

interface A{

void msg();

}

class E1 extends Thread implements A{

public void msg(){

System.out.println("Interface implemented");

}

public void run(){

System.out.println("E1- Thread 1");

}

}

class E2 extends Thread{

public void run(){

System.out.println("E2- Thread 2");

}

}

public class LMN {

 

public static void main(String[] args) {

// TODO Auto-generated method stub

E1 e1=new E1();

e1.start();

e1.msg();

Thread t1=new Thread(new E2());

t1.start();

}

}

       

 

0
Bijay Satyal
Nov 3, 2021
More related questions

Questions Bank

View all Questions