threaddemo2.java
来自「多线程是JAVA的难点」· Java 代码 · 共 23 行
JAVA
23 行
public class ThreadDemo2
{
public static void main(String [] args)
{
TestThread tt=new TestThread();
Thread t=new Thread(tt);
t.start();
while(true)
{
System.out.println("main thread is running");
}
}
}
class TestThread implements Runnable
{
public void run()
{
while(true)
{
System.out.println(Thread.currentThread().getName()+" is running");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?