class GetTime
{
public void getTime()
{
long start = System.currentTimeMillis();
runcode();
long end = System.currentTimeMillis();
System.out.println("时间为:" + (end - start));
}
public void runcode()
{
for (int i=0;i<10;i++)
{
System.out.print("i1=" + i);
}
}
}
class SubTime extends GetTime
{
public void runcode()
{
for (int i=0;i<10;i++)
{
System.out.print("i2=" + i);
}
}
}
class Test3
{
public static void main(String[] args)
{
//GetTime gt = new GetTime();
SubTime sub = new SubTime();
sub.getTime();
GetTime get = new GetTime();
get.getTime();
}
}