问题:这样可以么,设置等待时间
public static void main(String[] args) throws Exception {
List<Thread> threads = new ArrayList<>();
for (String name : Arrays.asList("Bob", "Alice", "Tom")) {
threads.add(new HelloThread(name));
}
System.out.println("START");
for (Thread t : threads) {
t.start();
t.join(300);
}
Thread.sleep(1000);
System.out.println("END");
}
- 1