注意:此页面搜索的是所有试题
题目内容
(国家开放大学Java语言程序设计1)
下列代码创建一个新线程并启动线程。
Runnable target=new MyRunnable();
Thread myThread=new Thread(target);
其中,( )类可以创建target对象,并能编译正确。
单选题 (2.5 分)
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 extends Runnable {void run() {}}
Runnable target=new MyRunnable();
Thread myThread=new Thread(target);
其中,( )类可以创建target对象,并能编译正确。
单选题 (2.5 分)
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 extends Runnable {void run() {}}
参考答案