- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththread_constructor.java
More file actions
Latest commit
22 lines (21 loc) · 641 Bytes
/
Copy paththread_constructor.java
File metadata and controls
22 lines (21 loc) · 641 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
classMyThrextendsThread{
publicMyThr(Stringname){
super(name);
}
publicvoidrun(){
inti = 34;
System.out.println("Thank you");
}
}
publicclassthread_constructor {
publicstaticvoidmain(String[] args) {
MyThrt1 = newMyThr("jay");
MyThrt2 = newMyThr("viru");
t1.start();
t2.start();
System.out.println("The id of the thread t is " + t1.getId());
System.out.println("The name of the thread t is " + t1.getName());
System.out.println("The id of the thread t is " + t2.getId());
System.out.println("The name of the thread t is " + t2.getName());
}
}