abstract class GetTime{
public final void getTime(){
long start = System.currentTimeMillis();
runCode();
long end = System.currentTimeMillis();
System.out.println("毫秒:"+(end - start));
}
public abstract void runCode();
}
class SubTime extends GetTime{
public void runCode(){
for(int x=0;x<4000;x++){
System.out.print(" "+x);
}
}
}
public class Demo{
public static void main(String[] args){
SubTime gt = new SubTime();
gt.getTime();
}
} 作者: 彭璞 时间: 2012-11-28 01:13
点错了提交了还没问问题