📄 thread1.java
字号:
package com.resource;
public class Thread1 extends Thread {
String s;
int i;
public Thread1(String s,int i){this.s=s;this.i=i;}
public void run(){
int count=0;
try{
while (true)
{
System.out.print(this.s+" ");
sleep(this.i);
count++;
if (count>10) break;
}
System.out.println("Thread"+this.s+"finish running");
}catch(InterruptedException e){System.out.println("Interrupted Exception");}
catch(IllegalMonitorStateException e){System.out.println("Illegal Monitor State Exception");}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -