线程中的一道题。

来源:百度知道 编辑:UC知道 时间:2024/06/17 03:01:16
.运行下列程序, 会产生什么结果
public class X extends Thread implements Runable{
public void run(){
System.out.println("this is run()");
}
public static void main(String args[])
{
Thread t=new Thread(new X());
t.start();
}
}
A 第一行会产生编译错误

B 第六行会产生编译错误

C 第六行会产生运行错误

D 程序会运行和启动
为什么答案是A?解释一下,谢谢!

Thread 已经实现了 Runable 接口

继承THREAD或者实现RUNNABLE借口,不是两个都写,这个程序没别的错误啊,你把上面的删一个就行。。。我估计,呵呵,多试试吧