java 基本数据类型跟封装类型的差距
作者:互联网
import java.util.*;
class test1{
public static void main(String[] args){
long start1 = System.currentTimeMillis();
Long sum = 0l;
for(long i = 0;i<Integer.MAX_VALUE;i++){
sum+=1;
}
System.out.println(sum);
long end1 = System.currentTimeMillis();
System.out.println(end1-start1);
long start2 = System.currentTimeMillis(); long sum2 = 0l; for(long i = 0;i<Integer.MAX_VALUE;i++){ sum2+=1; } System.out.println(sum2); long end2 = System.currentTimeMillis(); System.out.println(end2-start2); }
}
基本类型更可靠
标签:end1,java,数据类型,System,long,currentTimeMillis,封装,out 来源: https://blog.51cto.com/u_8056676/2827748