package text;
class TemplateDemo{
public static void main(String[] args){
SubTime gt=new SubTime();
gt.runcode();
}
}
public abstract class GetTime {
public GetTime(){
long start=System.currentTimeMillis();
runcode();
long end=System.currentTimeMillis();
System.out.print("毫秒="+(end-start));
}
abstract void runcode();
}
class SubTime extends GetTime
{
void runcode(){
for(int x=0;x<1000;x++);
{
System.out.print("x");
}
}
}
|
|