Skip to content

Commit 12368c6

Browse files
authored
Add files via upload
1 parent 0027064 commit 12368c6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Multithreading/Multithreading1.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package Multithreading;
2+
3+
class Multithreading1 {
4+
public static void main(String[] args) {
5+
Thread t=Thread.currentThread();
6+
System.out.println("Current Thread: "+t);
7+
t.setName("MyThread");
8+
System.out.println("After Name Change:"+t);
9+
try{
10+
for(int i=5;i>0;i--)
11+
{
12+
System.out.println(i);
13+
Thread.sleep(1000);
14+
}
15+
}
16+
catch(InterruptedException e){
17+
System.out.println("Main Interrupted");
18+
}
19+
}
20+
21+
}

0 commit comments

Comments
 (0)