一个显示当前秒的代码.
public class PrintDemo
{
public static void main(String[] args)
{ Clock c = new Clock();
Timer t = new Timer();
t.schedule(c, 0, 500);
try
{
Thread.sleep(5000);
} catch (Exception e)
{ }
t.cancel();
}
}
class MyClock extends TimerTask
{
public void run() 
{
System.out.println(Calendar.getInstance().get((Calendar.SECOND))+"秒");
}
}我想让显示的秒数~可以固定在屏幕上的一个位置~去刷新
而不是顺序打印下去~