- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThread_Practice.java
More file actions
Latest commit
30 lines (29 loc) · 703 Bytes
/
Copy pathThread_Practice.java
File metadata and controls
30 lines (29 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
packagecom.company;
classMyThread1extendsThread
{
@Override
publicvoidrun() {
for (inti = 0; i <=10; i++) {
System.out.println("MyThread is running ");
System.out.println("I am happy");
}
}
}
classMyThread2extendsThread
{
@Override
publicvoidrun() {
for (inti = 0; i <10; i++) {
System.out.println("I am happy");
System.out.println("This is good");
}
}
}
publicclassThread_Practice {
publicstaticvoidmain(String[] args) {
MyThread1t1=newMyThread1();
MyThread2t2=newMyThread2();
t1.start();
t2.start();
}
}