📄 currentthreaddemo.java
字号:
class CurrentThreadDemo{
public static void main(String args[]){
Thread t = Thread.currentThread();
System.out.println("Current thread: "+t);
t.setName("My Thread");
System.out.println("Current thread: "+t);
try {
for (int n=5; n>0; n--) {
System.out.println(""+n);
Thread.sleep(1000); // 1 second
}
} catch (InterruptedException e){
System.out.println("Interrupted");
}
} // current thread: Thread[My Thread,5,main], 5,4,3,2,1
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -