1.

The following block of code creates a Thread using a Runnable target:

Runnable target = new MyRunnable();
Thread myThread = new Thread(target);

Which of the following classes can be used to create the target, so that the preceding code compiles correctly?

A. Public class MyRunnable extends Runnable{public void run(){}}
B. Public class MyRunnable extends Object{public void run(){}}
C. Public class MyRunnable implements Runnable{public void run(){}}
D. Public class MyRunnable implements Runnable{void run(){}}
Answer» D. Public class MyRunnable implements Runnable{void run(){}}


Discussion

No Comment Found