搞不懂的Thread 的 問題

class A implements Runnable { public void run() {System.out.print(Thread.currentThread().getName());}}class B implements Runnable { public void run() { new A().run(); new Thread(new A(),"T2").run(); new Thread(new A(),"T3").start(); }}class C { public static void main (String[]... 顯示更多 class A implements Runnable { public void run() {System.out.print(Thread.currentThread().getName());}}class B implements Runnable { public void run() { new A().run(); new Thread(new A(),"T2").run(); new Thread(new A(),"T3").start(); }}class C { public static void main (String[] args) { new Thread(new B(),"T1").start(); }}

What is the result of attempting to compile and run the program?

為何答案是Prints: T1T1T3 呢?
可以講詳細一點的流程嗎? Q_Q
1 個解答 1