package xiancheng;public class TestRun { public static void main(String[] args) { //1.创建一个线程体 Task task=new Task(); Thread t=new Thread(task); Thread t1=new Thread(task); t.start(); t1.start(); //new Thread(new Task()).start(); }}//创建一个线程体;class Task implements Runnable{ @Override public void run() { for(int i=0;i<100;i++){ System.out.println(Thread.currentThread().getName()+": "+i); } } }