【发布时间】:2012-08-14 06:58:51
【问题描述】:
class testx
{
public testx()
{
long startTime = System.nanoTime();
System.out.println((System.nanoTime() - startTime));
}
public static void main(String args[])
{
new testx();
new testx();
new testx();
}
}
我总是得到类似于7806 660 517 的结果。为什么第一次调用的时间是其他调用的 10 倍?
【问题讨论】:
标签: java performance time nanotime