题目详情
单选题 分析代码:public class Test implements Runnable { public static void main(String[] args) { Test t = new Test(); } public Test() { Thread t = new Thread(this); t.start(); } public void run() { System.out.println("test"); }}
A. 该程序编译并运行,并显示test
B. 该程序编译并运行,什么也不显示
C. 该程序有一个编译错误,因为在main()方法和构造函数Test()中都定义了t
D. 该程序可以正常编译,但无法运行,因为不能在构造函数中使用关键字this

学科:默认课程
时间:2025-06-15 11:22:42
相关题目
相关作业
