- public class Test
- {
- public static void main(String[] args)
- {
- for (int i = 0; i < 3; i++)
- {
- TestThread tt = new TestThread();
- System.out.println("Main : " + tt.getName());
- tt.setName("ABC" + i);
- System.out.println("Main : " + tt.getName());
- tt.start();
- }
- // TestThread tt = ;
- }
- public static class TestThread extends Thread
- {
- public void run()
- {
- System.out.println("Thread : " + getName() + " is running.");
- }
- }
- }
複製代碼 請問有冇咩方法可以用返晒之前果啲 thread 呀 ? (只計頭一個for loop 入面果啲)(ABC0 , ABC1 , ABC2)
前提係唔可以喺出面create 定啲thread出嚟代替for loop 入面嘅create thread |