[单项选择题] 下列程序通过实现Runnable接口创建一个线程,选择正确的语句填入程序的横线处。class MyRun implements Runnable
2021-07-20
[单项选择题] 下列程序通过实现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
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。
