import java.util.*;
public class lx implements Runnable{
int time;
String name;
public lx(int time,String name)
{
this.time=time;
this.name=name;
}
public void run()
{
while(true)
{
try
{
System.out.println(name+":"+new Date(System.currentTimeMillis()));
Thread.sleep(time);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
public static void main(String[] args) {
Thread l=new Thread(new lx(1000,"fast"));
l.start();
Thread x=new Thread(new lx(3000,"slow"));
x.start();
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载