?? third.java
字號:
package demo.chapter09;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Third {
public static void main(String[] args) throws InterruptedException, IOException {
Thread t = new Thread() {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(i);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println("線程結束");
}
};
t.start();
BufferedReader reader = new BufferedReader(
new InputStreamReader(System.in));
System.out.println("主線程開始等待用戶輸入");
String s = reader.readLine(); // 當執行該方法時,主線程進入阻塞狀態
System.out.println("收到用戶輸入:" + s);
System.out.println("主線程結束");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -