程序員想要?jiǎng)?chuàng)建一個(gè)名為MyThread的類以便在main方法中用Thread實(shí)例化。對(duì)于下面三行: MyThread必須繼承Thread。 MyThread必須實(shí)現(xiàn)Thread。 MyThread必須覆蓋public void run()。 有幾行是正確的()
A. 0 B. 1 C. 2 D. 3
現(xiàn)有: class Thread2 implements Runnable { void run() { System.out.print ("go¨); } public static void main(String [] args) { Thread2 t2=new Thread2(); Thread t=new Thread(t2); t.start(); } } 結(jié)果為:()
A.go B.運(yùn)行時(shí)異常被拋出 C.代碼運(yùn)行,無輸出結(jié)果 D.編譯失敗
A.0 B.1 C.5 D.10