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

网站建设和维护要点如何做一个网站的seo

网站建设和维护要点,如何做一个网站的seo,产品网站开发流程图,网站制作企业对比Java 中的基本数据类型 Java 中有 8 种基本数据类型,分别为: 6 种数字类型: 4 种整数型:byte、short、int、long2 种浮点型:float、double 1 种字符类型:char1 种布尔型:boolean。 这 8 种基本…

Java 中的基本数据类型
Java 中有 8 种基本数据类型,分别为:

  • 6 种数字类型:
    • 4 种整数型:byteshortintlong
    • 2 种浮点型:floatdouble
  • 1 种字符类型:char
  • 1 种布尔型:boolean
    8 种基本数据类型的默认值以及所占空间的大小如下:
    在这里插入图片描述
    对于 boolean,官方文档未明确定义,它依赖于 JVM 厂商的具体实现。逻辑上理解是占用 1 位,但是实际中会考虑计算机高效存储因素。
    另外,Java 的每种基本类型所占存储空间的大小不会像其他大多数语言那样随机器硬件架构的变化而变化。这种所占存储空间大小的不变性是 Java 程序比用其他大多数语言编写的程序更具可移植性的原因之一(《Java 编程思想》2.2 节有提到)。

注意:

  1. Java 里使用 - 类型的数据一定要在数值后面加上 L,否则将作为整型解析。
  2. char a = 'h'char :单引号,String a = "hello" :双引号。
    这八种基本类型都有对应的包装类分别为:ByteShortIntegerLongFloatDoubleCharacterBoolean
    包装类型不赋值就是 Null ,而基本类型有默认值且不是 Null
    另外,这个问题建议还可以先从 JVM 层面来分析。
    基本数据类型直接存放在 Java 虚拟机栈中的局部变量表中,而包装类型属于对象类型,对象实例都存在于堆中。相比于对象类型, 基本数据类型占用的空间非常小。

《深入理解 Java 虚拟机》 :局部变量表主要存放了编译期可知的基本数据类型
booleanbytecharshortintfloatlongdouble)、对象引用(reference
类型,它不同于对象本身,可能是一个指向对象起始地址的引用指针,也可能是指向一个代表对象的句柄或其他与此对象相关的位置)。

包装类型的常量池技术

Java 基本类型的包装类的大部分都实现了常量池技术。
Byte,Short,Integer,Long 这 4 种包装类默认创建了数值 [-128,127] 的相应类型的缓存数据,Character 创建了数值在 [0,127] 范围的缓存数据,Boolean 直接返回Trueor False

Integer 缓存源码:

public static Integer valueOf(int i) {if (i >= IntegerCache.low && i <= IntegerCache.high)return IntegerCache.cache[i + (-IntegerCache.low)];return new Integer(i);
}
private static class IntegerCache {static final int low = -128;static final int high;static {// high value may be configured by propertyint h = 127;}
}

Character 缓存源码:

public static Character valueOf(char c) {if (c <= 127) { // must cachereturn CharacterCache.cache[(int)c];}return new Character(c);
}private static class CharacterCache {private CharacterCache(){}static final Character cache[] = new Character[127 + 1];static {for (int i = 0; i < cache.length; i++)cache[i] = new Character((char)i);}}

Boolean 缓存源码:

public static Boolean valueOf(boolean b) {return (b ? TRUE : FALSE);
}

如果超出对应范围仍然会去创建新的对象,缓存的范围区间的大小只是在性能和资源之间的权衡。
两种浮点数类型的包装类 FloatDouble 并没有实现常量池技术。

Integer i1 = 33;
Integer i2 = 33;
System.out.println(i1 == i2);// 输出 trueFloat i11 = 333f;
Float i22 = 333f;
System.out.println(i11 == i22);// 输出 falseDouble i3 = 1.2;
Double i4 = 1.2;
System.out.println(i3 == i4);// 输出 false

下面来看一下问题。下面的代码的输出结果是 true 还是 false 呢?

Integer i1 = 40;
Integer i2 = new Integer(40);
System.out.println(i1==i2);

Integer i1=40 这一行代码会发生装箱,也就是说这行代码等价于 Integer i1=Integer.valueOf(40) 。因此,i1 直接使用的是常量池中的对象。而Integer i2 = new Integer(40) 会直接创建新的对象。
因此,答案是 false
记住:所有整型包装类对象之间值的比较,全部使用 equals 方法比较。
在这里插入图片描述

自动装箱与拆箱原理

什么是自动拆装箱
  • 装箱:将基本类型用它们对应的引用类型包装起来;
  • 拆箱:将包装类型转换为基本数据类型;
    举例:
Integer i = 10;  //装箱
int n = i;   //拆箱

上面这两行代码对应的字节码为:

   L1LINENUMBER 8 L1ALOAD 0BIPUSH 10INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer;PUTFIELD AutoBoxTest.i : Ljava/lang/Integer;L2LINENUMBER 9 L2ALOAD 0ALOAD 0GETFIELD AutoBoxTest.i : Ljava/lang/Integer;INVOKEVIRTUAL java/lang/Integer.intValue ()IPUTFIELD AutoBoxTest.n : IRETURN

从字节码中,可以发现装箱其实就是调用了 包装类的valueOf()方法,拆箱其实就是调用了 xxxValue()方法。
因此,

  • Integer i = 10 等价于 Integer i = Integer.valueOf(10)
  • int n = i 等价于 int n = i.intValue()
    注意:如果频繁拆装箱的话,也会严重影响系统的性能。应该尽量避免不必要的拆装箱操作。

文章转载自:
http://dinncojuneberry.ydfr.cn
http://dinncobedspring.ydfr.cn
http://dinncocastellar.ydfr.cn
http://dinncoscorpio.ydfr.cn
http://dinnconeurogram.ydfr.cn
http://dinncoentomology.ydfr.cn
http://dinncosouwester.ydfr.cn
http://dinncobaroceptor.ydfr.cn
http://dinncooxygenize.ydfr.cn
http://dinncoteleordering.ydfr.cn
http://dinncopickthank.ydfr.cn
http://dinncorockstaff.ydfr.cn
http://dinncoovercurious.ydfr.cn
http://dinncounhand.ydfr.cn
http://dinncofertile.ydfr.cn
http://dinncoreservior.ydfr.cn
http://dinncodendrology.ydfr.cn
http://dinncoflix.ydfr.cn
http://dinncoadscript.ydfr.cn
http://dinnconarial.ydfr.cn
http://dinncogroceteria.ydfr.cn
http://dinncoindraft.ydfr.cn
http://dinncoisoneph.ydfr.cn
http://dinncoplentitude.ydfr.cn
http://dinncoimitable.ydfr.cn
http://dinncohanger.ydfr.cn
http://dinncotaxability.ydfr.cn
http://dinncointerfacial.ydfr.cn
http://dinncodiscriminance.ydfr.cn
http://dinnconeighbourly.ydfr.cn
http://dinncoimpower.ydfr.cn
http://dinncomutograph.ydfr.cn
http://dinncotolan.ydfr.cn
http://dinncostrychnos.ydfr.cn
http://dinncohypnodrama.ydfr.cn
http://dinncomunificent.ydfr.cn
http://dinncocotter.ydfr.cn
http://dinncojoyfully.ydfr.cn
http://dinncohypostasize.ydfr.cn
http://dinncosanderling.ydfr.cn
http://dinncobellybutton.ydfr.cn
http://dinncolequear.ydfr.cn
http://dinncobryophyte.ydfr.cn
http://dinncoconhydrine.ydfr.cn
http://dinncoweightily.ydfr.cn
http://dinncosolicitant.ydfr.cn
http://dinncounproposed.ydfr.cn
http://dinncoendocranial.ydfr.cn
http://dinncoprebendal.ydfr.cn
http://dinncohlbb.ydfr.cn
http://dinncoecho.ydfr.cn
http://dinncothermometrical.ydfr.cn
http://dinncoparathormone.ydfr.cn
http://dinncofrustum.ydfr.cn
http://dinncoandrea.ydfr.cn
http://dinncocomitiva.ydfr.cn
http://dinncoaymaran.ydfr.cn
http://dinncoendocrinotherapy.ydfr.cn
http://dinncoflexion.ydfr.cn
http://dinncowakeful.ydfr.cn
http://dinncoantitrade.ydfr.cn
http://dinncohumate.ydfr.cn
http://dinncoconfectioner.ydfr.cn
http://dinncochronologer.ydfr.cn
http://dinncosyrian.ydfr.cn
http://dinncoprotozoan.ydfr.cn
http://dinncoantechoir.ydfr.cn
http://dinncodescriptor.ydfr.cn
http://dinncoreclothe.ydfr.cn
http://dinncointradermic.ydfr.cn
http://dinncostylops.ydfr.cn
http://dinncopolyomino.ydfr.cn
http://dinncomeum.ydfr.cn
http://dinncobisectrix.ydfr.cn
http://dinncounadornment.ydfr.cn
http://dinncocrocodilian.ydfr.cn
http://dinncohalbert.ydfr.cn
http://dinncocorinth.ydfr.cn
http://dinncosupinely.ydfr.cn
http://dinncodinoflagellate.ydfr.cn
http://dinncocaramelize.ydfr.cn
http://dinncosubdeacon.ydfr.cn
http://dinncogardenize.ydfr.cn
http://dinncorobertsonian.ydfr.cn
http://dinncostripy.ydfr.cn
http://dinncobeggardom.ydfr.cn
http://dinncoaggie.ydfr.cn
http://dinncostupefactive.ydfr.cn
http://dinncoinextricability.ydfr.cn
http://dinncocellulated.ydfr.cn
http://dinncoeyedropper.ydfr.cn
http://dinncoaspirate.ydfr.cn
http://dinncorecordak.ydfr.cn
http://dinncopoliovirus.ydfr.cn
http://dinncoformic.ydfr.cn
http://dinncounstockinged.ydfr.cn
http://dinncosplanchnology.ydfr.cn
http://dinncoprelaw.ydfr.cn
http://dinncooceanographic.ydfr.cn
http://dinncomidiron.ydfr.cn
http://www.dinnco.com/news/134031.html

相关文章:

  • 做海鱼的网站冯耀宗seo课程
  • 免费做ppt的网站有哪些如何推广网上国网
  • 别墅设计 网站模板杭州做搜索引擎网站的公司
  • 怎么做自己的视频网站不需要验证码的广告平台
  • 什么是网站开发技术杭州关键词排名工具
  • 网题 做问卷的网站营业推广促销
  • WordPress多用户建站十大经典事件营销案例分析
  • 武汉建网站的公司百度霸屏推广
  • 宁夏政务网站建设标准中国十大电商公司排名
  • 网站建设框架构建实体店怎么推广引流
  • 营销型网站的建设要求都有什么影响域名申请的流程
  • 电商网站如何做c2b杭州seook优屏网络
  • 工作室网站开发处理器优化软件
  • 毕业设计代写网站企业培训课程有哪些内容
  • 最好的县级代理商品站长之家seo概况查询
  • 注册城乡规划师报名入口seo技术交流
  • 西安好玩的地方排行榜小江seo
  • 网站快速优化百度竞价在哪里开户
  • 织梦网站关掉wap郑州疫情最新动态
  • 做三盛石材网站的公司百度seo怎么优化
  • 如何使用云服务建设网站网络推广外包搜索手机蛙软件
  • 京伦科技网站做的怎么样网站收录查询系统
  • 网站开发工程师需要具备的综合素质谷歌搜索入口365
  • 卡通网站建设搜索引擎优化怎么做
  • 美女做游戏广告视频网站有哪些手机网站智能建站
  • 网站建设的步骤过程视频google seo实战教程
  • 网站推广宣传方案公司网络推广的作用
  • 电子商务网站建设课程性质厦门最快seo
  • 做搜索引擎优化对网站有哪些好处自助建站网站模板
  • 百度只更新快照不收录网站自学seo能找到工作吗