abstract class GetTime
{
public final void getTime()
{
long start = System.currentTimeMillis();
runtime();
long end=System.currentTimeMillis();
System.out.print("毫秒:"+(start-end));
}
public abstract void runtime();
}
class subTime extends GetTime
{
public void runtime()
{
for(int i=0;i<889;i++)
{
System.out.print(i);
}
}
}
class getTimeDemo
{
public static void main(String[] args)
{
//GetTime ss=new GetTime();
subTime ss=new subTime();
ss.getTime();
}
}
|
|