下面两个类,&nbsp想在第二个类里面启动第一个类的线程,在第15行应该...
发布于 2022-03-03 16:39:17
下面两个类, 想在第二个类里面启动第一个类的线程,在第15行应该怎样做?( )1public class Century implements Runnable {
2public void run () {
3for (int year = 1900year < 2000year++) {
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 }
2public void run () {
3for (int year = 1900year < 2000year++) {
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 }
登录后免费查看答案
关注者
0
被浏览
47