java——简单多线程

/**
 * Created by xabcd on 2019/2/17.
 */
public class test_thread
{
    public static void main(String args[])
    {
        new testread().start();
        for(int i = 0;i<10;i++)
        {
            System.out.println("main函数正在运行!");
        }
    }
}
class testread extends Thread
{
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("run函数正在运行");
        }
    }
}

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注