long start = System.nanoTime();<pre name="code" class="java">Formatter f = new Formatter();
long start = System.nanoTime();
for(int i=0; i<10; i++)
for(int j=0; j<1000; j++)
for(int k=0; k<10000; k++)
;
long end = System.nanoTime();
f.format("%-10s %15d\n", "First", (end - start));
异常:The method format(String, Object[]) in the type Formatter is not applicable for the arguments (String, String, long)
原因:该格式化方法是在jdk1.5才出现的,座椅判断是jdk版本太低,我现在安装的版本是jdk1.8,确定不是安装的问题,那就应该是设置问题了
解决:项目右键==>>Properties==>>java Complier==>>Compiler compliance level 改为1.5