📄 motherthread.java
字号:
public class MotherThread implements Runnable
{
public void run()
{
System.out.println("妈妈准备煮饭");
System.out.println("妈妈发现米酒用完了");
System.out.println("妈妈叫儿子去买米酒");
Thread son = new Thread(new SonThread());
son.start();
System.out.println("妈妈等待儿子把米酒买回来");
try {
son.join();
}
catch (InterruptedException ie)
{
System.err.println("发生异常!");
System.err.println("妈妈中断煮饭");
System.exit(1);
}
System.out.println("妈妈开始煮饭");
System.out.println("妈妈煮好饭了");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -