- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThread_Ex.java
More file actions
Latest commit
35 lines (30 loc) · 701 Bytes
/
Copy pathThread_Ex.java
File metadata and controls
35 lines (30 loc) · 701 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
31
32
33
34
35
classMyThread1extendsThread{
@Override
publicvoidrun(){
inti =0;
while(i<40000){
System.out.println("My Cooking Thread is Running");
System.out.println("I am happy!");
i++;
}
}
}
classMyThread2extendsThread{
@Override
publicvoidrun(){
inti =0;
while(i<40000){
System.out.println("Thread 2 for Chatting with her");
System.out.println("I am sad!");
i++;
}
}
}
publicclassThread_Ex {
publicstaticvoidmain(String[] args) {
MyThread1t1 = newMyThread1();
MyThread2t2 = newMyThread2();
t1.start();
t2.start();
}
}