A-A+

下列程序通过实现Runnable接口创建一个线程 选择正确的语句填入程序的横线处。 clas

2022-08-06 01:16:08 问答库 阅读 174 次

问题详情

下列程序通过实现Runnable接口创建一个线程,选择正确的语句填入程序的横线处。 class MyRun implements Runnable { String str; MyRun(String s) { str = s; } public void run() System.out.println(str); } } public class ex40 { public static void main(String[] args) { String name = "实现阶段Runnable 接口"; MyRun my = new MyRun(name); Thread th = th. start (); } }
A.new MyRun(my)
B.new Thread()
C.new Thread(my)
D.Thread(my)请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:C

考点:程序,横线