简单多线程创建

package com.aaa.thread.Test;

public class Runable implements Runnable{
    @Override
    public void run() {
        for (int i=1;i<=10;i++){
            System.out.println( Thread.currentThread().getName() + "___" + i);
            //当前线程:current
            System.out.println(Thread.currentThread().getState());
        }
    }

    public static void main(String[] args) {
        Runnable runnable = new Runable();
        Runnable runnable1 = new Runable();
        Thread t1=new Thread(runnable);
        Thread t2=new Thread(runnable1,"new???");
        t1.start();
        t2.start();
    }
}

 

posted @ 2019-07-02 09:43  织式  阅读(249)  评论(0编辑  收藏  举报