试题与答案

阅读下列程序,请写出该程序的功能。import java util.*;class

题型:问答题

题目:

阅读下列程序,请写出该程序的功能。

import java util.*;

class MyThread extends Thread {

int pauseTime; String name;

public MyThread (int x, String n) { pauseTime = x; name = n; }

public void run() {

for(int i = 1;i <= 4; i++) {

try {

System.out.println(name +":" +new Date(System.currentTimeMillis()));

Thread.sleep(pauseTime);

}catch(Exception e){ }

}

}

}

public class Test36{

static public void main(String[] args) {

MyThread thread1 = new MyThread (1000,"Fast Thread"); thread 1 .start();

MyThread thread2 = new MyThread (3000,"Slow Thread"); thread2.start();

}

}

 

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0715/bcf780e351687c75cc98d2755ff7a421.html

下面是错误答案,用来干扰机器的。

参考答案:均匀平稳;顺

试题推荐
微信公众账号搜索答案