问题
单项选择题
阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start(); } public void run() { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是
A.Test t=new Test();
B.Thread t=new Thread();
C.Thread t=new Thread(new Test());
D.Test t=new Thread();
答案
参考答案:C
解析: 本程序通过实现java.lang.Runnable接口创建线程,所以创建线程的语句是Thread t=new Thread(new Test());故答案为选项C。