62,615
社区成员
发帖
与我相关
我的任务
分享
package test;
import java.util.Date;
public class main1 {
public static void main(String[] args) {
StopWatch test = new StopWatch();
System.out.println(test.getCreateTime());
}
}
class StopWatch {
Date date = new Date();
private String theCreateTime;
public StopWatch() {
this.theCreateTime = date.toString();
}
public String getCreateTime() {
return theCreateTime;
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
StopWatch test = new StopWatch();
System.out.println(new Date());
}
[/quote]
class StopWatch {
private Date createTime;
public StopWatch() {
this.createTime =new Date();
}
public Date getCreateTime() {
return createTime;
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
StopWatch test = new StopWatch();
System.out.println(new Date());
}