Hi,
This is a question from Dan's mock exam on the topic "threads"
class A implements Runnable {
public void run() {System.out.print(Thread.currentThread().getName());}
}
class B implements Runnable {
public void run() {
new A().run(); // is it a normal method call of class A
new
Thread(new A(),"T2").run(); // doesn't create a new thread. what does it exactly do
new Thread(new A(),"T3").start(); // starts a new thread
}
}
class C {
public static void main (
String[] args) {
new Thread(new B(),"T1").start(); // starts a new thread
}
}
The ans is T1T1T3. Pl. explain the code to me.
-Sanjana