public class TemplateDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
SubTime g = new SubTime();
g.getTime();
}
}
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);
}
}
}
|
|