java——简单多线程

2019年2月17日19:11:54 发表评论 454 views
/**
 * 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函数正在运行");
        }
    }
}

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: