Slip 21Q1
Save as "Slip21Q21"
CODE:
class Slip21Q1 extends Thread {
@Override
public void run() {
System.out.println("Cuttent thread Name "+this.getName());
System.out.println("Current thread priority "+this.getPriority());
System.out.println();
}
public static void main(String[] args) {
Slip21Q1 thread1 = new Slip21Q1();
Slip21Q1 thread2 = new Slip21Q1();
thread2.setName("groot");
thread2.setPriority(6);
Slip21Q1 thread3 = new Slip21Q1();
thread3.setName("Amar");
thread3.setPriority(2);
thread1.run();
thread2.run();
thread3.run();
}
}
No comments:
Post a Comment