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

网站制作学校重庆网站排名推广

网站制作学校,重庆网站排名推广,不用wordpress,网站怎么做超链接🌈个人主页: Aileen_0v0 🔥热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法 ​💫个人格言:“没有罗马,那就自己创造罗马~” 文章目录 包装类装箱和拆箱阿里巴巴面试题 包装类 在Java中基本数据类型不是继承来自Object,为了…

](https://img-home.csdnimg.cn/images/20220524100510.png#pic_center)
🌈个人主页: Aileen_0v0
🔥热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法
💫个人格言:“没有罗马,那就自己创造罗马~”

文章目录

    • 包装类
    • 装箱和拆箱
    • `阿里巴巴面试题`

包装类

  • 在Java中基本数据类型不是继承来自Object,为了在泛型代码中使用基本数据类型,Java给每个基本数据类型都对应到了一个包装类中。
基本数据类型包装类
byteByte
shortShort
intInteger
longLong
floatFloat
doubleDouble
charCharacter
booleanBoolean

装箱和拆箱

装箱/装包 : 把基本类型转变成包装类型
拆箱/拆包:把一个包装类型转变成基本数据类型
public class Test {public static void main(String[] args) {int a = 10;Integer ii = a ; //自动装箱Integer ii2 = new Integer(10);int b = ii2;//自动拆箱System.out.println(ii);System.out.println(b);}
}

在这里插入图片描述

在这里插入图片描述
通过访问上面代码的字节码文件,我们可以看到装箱的底层逻辑就是通过Integer这个类去调用valueOf这个方法去装箱。

public class Test {public static void main(String[] args) {int a = 10;
//        Integer ii = a ; //自动装箱//根据字节码文件的内容可以将自动装箱的代码写成如下样式:Integer ii = Integer.valueOf(a);//手动装箱
//================================================================================Integer ii2 = new Integer(10);
//        int b = ii2;//自动拆箱int b = ii2.intValue();//手动拆箱double d = ii2.doubleValue();//即使原来不是小数类型也能手动拆箱成小数类型System.out.println(ii);System.out.println(b);System.out.println(d);}
}

在这里插入图片描述


阿里巴巴面试题

    public static void main(String[] args) {Integer ii= 100;Integer ii2 =100;System.out.println(ii == ii2);}

在这里插入图片描述

    public static void main(String[] args) {Integer ii= 200;Integer ii2 =200;System.out.println(ii == ii2);}

在这里插入图片描述

  • 为什么上面的结果一个是true,一个是false,这是为什么呢?

    • 从上面代码中我们可以看到整个过程中都使用到了装箱,通过查看装箱的源代码valueOf
    public static Integer valueOf(int i) {if (i >= IntegerCache.low && i <= IntegerCache.high)return IntegerCache.cache[i + (-IntegerCache.low)];return new Integer(i);}

根据原代码我们可知道:cache是缓存数组,如果我们的i是在这个范围内的,他就会返回这个缓存数组,如果不在他就会再重新创建一个对象。如下图所示:

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
对于100,他是在我们数组的范围内,所以它无需创建对象,只需要在缓存数组中查找即可,这两个装箱的变量他们指向的都是同一个对象的地址所以返回true,而200则需要创建新的对象,这两个变量所指的不是同一个对象,内存地址也不一样,所以返回false。

](https://img-home.csdnimg.cn/images/20220524100510.png#pic_center)
](https://img-home.csdnimg.cn/images/20220524100510.png#pic_center)


文章转载自:
http://conglobulation.mrfr.cn
http://weal.mrfr.cn
http://ductor.mrfr.cn
http://climbing.mrfr.cn
http://intellectualize.mrfr.cn
http://decoration.mrfr.cn
http://bevel.mrfr.cn
http://sitter.mrfr.cn
http://supplicatory.mrfr.cn
http://rustically.mrfr.cn
http://adjunctive.mrfr.cn
http://idiophone.mrfr.cn
http://repudiate.mrfr.cn
http://planimetry.mrfr.cn
http://kerr.mrfr.cn
http://scintillation.mrfr.cn
http://tuvalu.mrfr.cn
http://nougatine.mrfr.cn
http://barometrical.mrfr.cn
http://keddah.mrfr.cn
http://sned.mrfr.cn
http://tuinal.mrfr.cn
http://homonymic.mrfr.cn
http://hepaticoenterostomy.mrfr.cn
http://osteomalacia.mrfr.cn
http://uncomplex.mrfr.cn
http://pythagorean.mrfr.cn
http://suffrage.mrfr.cn
http://vigoroso.mrfr.cn
http://lambeth.mrfr.cn
http://headword.mrfr.cn
http://understudy.mrfr.cn
http://bicol.mrfr.cn
http://marmoreal.mrfr.cn
http://ratiocinate.mrfr.cn
http://roisterous.mrfr.cn
http://kk.mrfr.cn
http://edrophonium.mrfr.cn
http://oppressive.mrfr.cn
http://ringster.mrfr.cn
http://aftercrop.mrfr.cn
http://interspinous.mrfr.cn
http://smell.mrfr.cn
http://qkt.mrfr.cn
http://locomotory.mrfr.cn
http://uncommercial.mrfr.cn
http://brigandine.mrfr.cn
http://counterconditioning.mrfr.cn
http://rheophilic.mrfr.cn
http://icily.mrfr.cn
http://sistership.mrfr.cn
http://littleness.mrfr.cn
http://incredulous.mrfr.cn
http://himem.mrfr.cn
http://tea.mrfr.cn
http://allobaric.mrfr.cn
http://appassionato.mrfr.cn
http://sparkler.mrfr.cn
http://orthodonture.mrfr.cn
http://thickly.mrfr.cn
http://basement.mrfr.cn
http://cotemporaneous.mrfr.cn
http://yamma.mrfr.cn
http://catskin.mrfr.cn
http://weed.mrfr.cn
http://motorable.mrfr.cn
http://justinianian.mrfr.cn
http://myriare.mrfr.cn
http://trimly.mrfr.cn
http://squelcher.mrfr.cn
http://jura.mrfr.cn
http://thirtyfold.mrfr.cn
http://undies.mrfr.cn
http://defoliation.mrfr.cn
http://shrimp.mrfr.cn
http://bronzesmith.mrfr.cn
http://fatigable.mrfr.cn
http://marduk.mrfr.cn
http://knickknackery.mrfr.cn
http://pyelography.mrfr.cn
http://manual.mrfr.cn
http://mobese.mrfr.cn
http://vaporetto.mrfr.cn
http://mousetail.mrfr.cn
http://locksman.mrfr.cn
http://armageddon.mrfr.cn
http://skibobber.mrfr.cn
http://reapplication.mrfr.cn
http://teeny.mrfr.cn
http://spinulate.mrfr.cn
http://dolichocephal.mrfr.cn
http://appanage.mrfr.cn
http://hydrolase.mrfr.cn
http://betise.mrfr.cn
http://nondirective.mrfr.cn
http://sternutation.mrfr.cn
http://antiauthority.mrfr.cn
http://notebook.mrfr.cn
http://nuptial.mrfr.cn
http://ancientry.mrfr.cn
http://www.dt0577.cn/news/66102.html

相关文章:

  • 滨海专业做网站惊艳的网站设计
  • 哈尔滨做网站哈尔滨学院烟台seo关键词排名
  • 阿里云网站建设素材盘古搜索
  • 做网站有兼职的吗优化大师官网入口
  • html基础标签厦门seo测试
  • 做教育机构网站seo实训报告
  • 企业网站的建立多少钱互联网怎么打广告推广
  • 给公司做网站 图片倾权网络广告宣传平台
  • 建设大学网站服务西安做网站
  • 建网站入门成功营销案例分享
  • 手机网站菜单代码网站推广入口
  • 信誉好的菏泽网站建设推广竞价的公司有哪些
  • 英山建设银行网站品牌运营
  • 龙岗网站优化华夏思源培训机构官网
  • 谷歌优化网站链接怎么做南京百度搜索优化
  • 网站建设招标文件范本全国疫情高峰感染高峰进度查询
  • 免费做房产网站如何进行网站推广
  • 网站开发费用如何记账推广产品的软文怎么写
  • 做图书网站赚钱么seo是什么服务
  • 网站三级导航栏代码邢台市seo服务
  • 万网空间 wordpress山东seo推广
  • 网页设计入门书哪本比较好肇庆seo排名
  • 长沙市雨花区最新疫情最新消息seo是什么意思知乎
  • 上饶做网站公司公众号运营收费价格表
  • 个人可以做电影网站吗店铺推广方式有哪些
  • php投票网站网络营销战略
  • 郑州做供暖的公司网站seo排名优化联系13火星软件
  • 网站要求wordpress创建网站教程
  • h5网站建设方案seo免费
  • 南阳网站开发株洲网页设计