📄 thread.java
字号:
import java.lang.Thread;
class mythread extends Thread{
mythread(String str){
super(str);
this.start();
}
public void run(){
int i;
for(i=1;i<=5;i++)
{
System.out.println("subThread:"+i);
try{
sleep(100);
}
catch(InterruptedException e){
}
}
}
}
class mainthread extends Thread{
public static void main(String args[])
{
new mythread("subthread");
int i;
for(i=1;i<=5;i++)
{
System.out.println("mainthread:"+i);
try{
sleep(100);
}
catch(InterruptedException e){
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -