📄 thread4.java
字号:
class Thread4 extends Thread
{
String s;
int m,i=0;
Thread4(String ss)
{
s=ss;
}
public void run()
{
try
{
for(i=0;i<6;i++)
{
sleep((int)(500*Math.random()));
System.out.println(s);
}
System.out.println(s+"finished! ");
}
catch(InterruptedException e)
{}
finally
{System.out.println("programm finished!!!");}
}
public static void main(String args[])
{
Thread4 threadA=new Thread4("A ");
Thread4 threadB=new Thread4("B ");
threadA.start();
try
{
threadA.join();
}
catch(InterruptedException e)
{}
threadB.start();
System.out.println("main is finished");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -