请帮我看一下java取系统时间的代码
<html>
<body>
<applet code="Clock.class" width="300",height="300">
</applet>
</body>
</html>
/**
* @(#)Clock.java
*
*
* @author
* @version 1.00 2008/12/21
*/
import javax.swing.*;
import java.util.Date;
public class Clock extends java.applet.Applet {
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init() {
Mytime time=new Mytime(0,0,0);
JPanel panel=new JPanel();
String s=time.getMyTime();
JLabel label=new JLabel(s);
add(label);
}
}
class Mytime extends Date
{
public Mytime(int h,int m,int s)
{
hours=h;
minutes=m;
seconds=s;
}
public String getMyTime()
{
hours=getHours();
minutes=getMinutes();
seconds=getSeconds();
return hours+":"+minutes+":"+seconds;
}
protected int hours, minutes, seconds;
}
在其他人机子上就能取出正确时间,我机子上取的时间却了错,请问是不是电脑上有病毒,还是本身系统时间有问题(但在桌面显示的时间又是正确的)