📄 例七.txt
字号:
class A implements Runnable
{
Thread thread;
int n=0;
A()
{
thread=new Thread(this);
}
public void run()
{
while(true)
{
n++;
System.out.println("你好!");
try{
Thread.sleep(1000);
}
catch(InterruptedException e)
{
}
if(n==5)
{
thread=new Thread(this);
thread.start();
}
}
}
}
class Example
{
public static void main(String args[ ])
{
A a=new A();
a.thread.start();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -