?? mainthread.java
字號:
package chapter10;
public class MainThread
{
public static void main(String args[])
{
//當前線程(主線程)實例化得到線程對象t
Thread t=Thread.currentThread ();
//輸出線程信息
System.out.println ("當前進程信息:"+ t);
// 更改線程名
t.setName ("MyMain");
System.out.println ("改名后信息:"+ t);
try
{
for (int i=5;i>0;i--)
{
System.out.println (i);
t.sleep (1000);
}
} catch (InterruptedException e)
{
System.out.println ("主線程被中斷.");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -