public class TemplateDemo {
class GetTime
{
public void getTime()
{
long start=System.currentTimeMillis();
for(int x=0;x<10000;x++)
{
System.out.println(x);
}
long end =System.currentTimeMillis();
System.out.println("毫秒"+(end-start));
}
}
public static void main(String[] args)
{
GetTime ge = new GetTime();
ge.getTime();
}
} 作者: 郭黎明 时间: 2014-4-6 07:32
public class TemplateDemo {
class GetTime
{
public void getTime()
{
long start=System.currentTimeMillis();
for(int x=0;x<10000;x++)
{
System.out.println(x);
}
long end =System.currentTimeMillis();
System.out.println("毫秒"+(end-start));
}
}
public static void main(String[] args)
{
GetTime ge = new TemplateDemo().new GetTime(); //这里是外部类访问内部类,内部类的类型TemplateDemo.GetTime的类型,所以新建时要先有new TemplateDemo()然后再有new GetTime()