当前位置: 首页 > news >正文

公司的网站建设与维护论文网站建设开票开什么内容

公司的网站建设与维护论文,网站建设开票开什么内容,做动漫网站的素材,做网站需要的费用一、装箱、拆箱定义如果一个int型量被传递到需要一个Integer对象的地方#xff0c;那么#xff0c;编译器将在幕后插入一个对Integer构造方法的调用#xff0c;这就叫做自动装箱。而如果一个Integer对象被放到需要int型量的地方#xff0c;则编译器将幕后插入一个队intValu…一、装箱、拆箱定义如果一个int型量被传递到需要一个Integer对象的地方那么编译器将在幕后插入一个对Integer构造方法的调用这就叫做自动装箱。而如果一个Integer对象被放到需要int型量的地方则编译器将幕后插入一个队intValue方法的调用这就叫做自动拆箱。public static voidmain(String[] args) {//装箱Integer i1 Integer.valueOf(1);//自动装箱Integer i2 1;//默认执行valueOf(1);System.out.println(i1 i2);//true//自动拆箱int i3 i1.intValue();int i4 i2.intValue();System.out.println(i3 i4);//true//超出Integer的缓存范围不从私有静态内部类IntegerCache的数组cache中获得通过new返回新对象Integer i5 128;Integer i6 -129;Integer i5_1 128;Integer i6_1 -129;System.out.println(i5 i5_1);//falseSystem.out.println(i6 i6_1);//false}所以说对于-127~127之间的值Integer对象中存在一个IntegerCache的私有静态内部类这个内部类有一个Integer类型的静态常量数组在这个内部类中通过静态方法块初始化了这个静态常量数组。默认这个数组保存[-127,128)之间的Integer对象。源码如下1 private static classIntegerCache {2 static final int low -128;3 static final inthigh;4 static finalInteger cache[];56 static{7 //high value may be configured by property8 int h 127;9 String integerCacheHighPropValue 10 sun.misc.VM.getSavedProperty(java.lang.Integer.IntegerCache.high);11 if (integerCacheHighPropValue ! null) {12 try{13 int i parseInt(integerCacheHighPropValue);14 i Math.max(i, 127);15 //Maximum array size is Integer.MAX_VALUE16 h Math.min(i, Integer.MAX_VALUE - (-low) -1);17 } catch( NumberFormatException nfe) {18 //If the property cannot be parsed into an int, ignore it.19 }20 }21 high h;2223 cache new Integer[(high - low) 1];24 int j low;25 for(int k 0; k cache.length; k)26 cache[k] new Integer(j);2728 //range [-128, 127] must be interned (JLS7 5.1.7)29 assert IntegerCache.high 127;30 }3132 privateIntegerCache() {}33 }通过下面的源码可以知道为什么Integer i 128;与Integer y 128;通过比较的结果为false。如果要赋值的int变量在范围内则返回数组中的对象给Integer如果不在则通过带参构造方法new一个新的Integer对象。1 public static Integer valueOf(inti) {2 if (i IntegerCache.low i IntegerCache.high)3 return IntegerCache.cache[i (-IntegerCache.low)];4 return newInteger(i);5 }二、其它包装类型The Java Language Specification, 3rd Edition 写道为了节省内存对于下列包装对象的两个实例当它们的基本值相同时他们总是Boolean 全部缓存Byte 全部缓存Character 127缓存Short (-128,127)缓存Long (-128,127)缓存Float (没有缓存)Double (没有缓存)其中Character的缓存源码1   private static classCharacterCache {2 privateCharacterCache(){}34 static final Character cache[] new Character[127 1];56 static{7 for (int i 0; i cache.length; i)8 cache[i] new Character((char)i);9 }10 }其中Float没有缓存直接返回源码1   public static Float valueOf(String s) throwsNumberFormatException {2 return newFloat(parseFloat(s));3 }三、用处除了包装类提供了额外的方法外当使用集合框架时泛型为Object类型所以如果声明为List list...则这样是不行的必须声明为List list...。四、存储的位置因为是对象所以存储在堆中。
http://www.zqtcl.cn/news/616927/

相关文章:

  • 做外贸网站多少钱成都网页设计专业
  • 北京比较好的网站公司在线医生免费咨询
  • 免费的个人网站怎么做企业网站管理系统软件
  • 枣庄住房和城乡建设局网站如何注册国外域名
  • 满洲里建设局网站网页设计公司的目标客户有哪些
  • 英文书 影印版 网站开发怀化组织部网站
  • 网站建设领域的基本五大策略要学会网站细节
  • dede做英文网站优化cms建站系统哪个好
  • eclipse sdk做网站邯郸技术服务类
  • 汕头网站网站建设西安网约车租车公司哪家好
  • 网站空间域名维护协议网络推广软件平台
  • 昆明网站建设公司猎狐科技怎么样wordpress主题打不开
  • 网站推广入口服饰网站建设 e-idea
  • 长沙网站建设电话2个女人做暧暧网站
  • 手机手机端网站建设电子商务网站建设步骤一般为
  • 上海金瑞建设集团网站怎样登陆网站后台
  • 定西模板型网站建设网络架构和现实架构的差异
  • 做搜索的网站做网站的代码有哪些
  • 视频制作网站推荐js做音乐网站
  • 海北wap网站建设公司有后台网站怎么做
  • 织梦网站最新漏洞入侵外贸网站模板有什么用
  • 在跨境网站贸易公司做怎么样网站建设维护合同范本
  • 网站必须做可信认证南山网站制作
  • 如何使用mysql数据库做网站企业管理专业大学排名
  • 九江网站建设九江深圳网站建设费用大概多少
  • 万网站长工具郑州seo哪家公司最强
  • 宁波哪里可以做网站企业网站源码哪个好
  • 网站每天点击量多少好精选聊城做网站的公司
  • 网站建设课程基础兰州网站seo费用
  • 天助可以搜索别人网站曲靖网站推广