问题
单项选择题
阅读下面代码
public class Test implements Runnable
public void run(Thread t)
System.out.println("Running");
public static void main(String[] args)
Thread tt=new Thread(new Test());
tt.start();
代码运行的结果是
A.将抛出一个异常
B.没有输出并正常结束
C.输出“Running”并正常结束
D.程序第2行将出现一个编译错误
答案
参考答案:D
解析: 本题程序是通过实现Runnable接口创建进程,其中的run()方法是在Runnable接口中声明的,没有参数,所以程序第二行编译错误。