public class ThreadTest { public static void main(String[] args) { Test test1 = new Test(); Test test2 = new Test(); test1.start(); test2.start(); for (int t = 0; t < 100; t++) { System.out.println(Thread.currentThread().getName() + " run " + t); } } } class Test extends Thread { @Override public void run() { for (int i = 0; i < 100; i++) { System.out.println(Thread.currentThread().getName() + " run " + i); } } }
原文地址:https://www.cnblogs.com/smartsmile/p/11605270.html
时间: 2024-10-20 02:38:33