> [单项选择题] 下列程序通过实现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)
问题:
发布时间:2022-07-01
[单项选择题] 下列程序通过实现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)