We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c747a1f commit c888436Copy full SHA for c888436
1 file changed
src/com/itcode/javaadv/callable/CallableAndFuture.java
@@ -60,7 +60,11 @@ public static void main(String[] args) {
60
61
es.submit(futureTask1);
62
System.out.println(task1.getName() + ":的执行结果Future调用get方法:" + futureTask1.get());
63
-
+
64
+ //FutureTask的第二种使用方式
65
+ FutureTask<String> futureTask = new FutureTask<>(task1);
66
+ Thread thread = new Thread(futureTask);
67
+ thread.start();
68
69
Future future2 = es.submit(task2);
70
Thread.sleep(5000);
0 commit comments