题库 软件开发 题目列表 下面两个类, 想在第二个类里面启动第一个类的线程,在...
单选题
下面两个类, 想在第二个类里面启动第一个类的线程,在第15行应该怎样做?( )1public class Century implements Runnable {
2public void run () {
3for (int year = 1900;year < 2000;year++) {
4System.out.println(year);
5try {Thread.sleep(1000);
6} catch(InterruptedException e) {}
7}
8System.out.println("Happy new millenium!");
9}
10}
11
12class CountUp {
13public static void main (String [] args) {
14Century ourCentury = new Century();
15
16   }
17 }
A.

Thread t = new Thread(this); t.start();

B.

Thread t = new Thread(this); t.start(ourCentury);

C.

Thread t = new Thread(this); ourCentury.run();

D.

Thread t = new Thread(ourCentury); t.start();

题目信息
校招真题
-
正确率
0
评论
14
点击