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

政府网站专题栏目建设方案新乡网站推广

政府网站专题栏目建设方案,新乡网站推广,来个网站好人有好报,山东神华网站建设1:A and A 2:A and A 3: A and D 4: B and A 5: B and A 6:A and D 7:B and A 8: B and A 9:A and D package 第四章对象和类;public class ForthThir {//多态:父类的引用指向子类的对象,只能调父类的方法和子类重写的方法,不能调子类独有的方法&…

1:A and A

2:A and A

3:   A and D

4:  B and A

5:  B and A

6:A and D

7:B and A

8: B and A

9:A and D

package 第四章对象和类;public class ForthThir {//多态:父类的引用指向子类的对象,只能调父类的方法和子类重写的方法,不能调子类独有的方法;子类则可以调父类独有的方法//条件:必须继承关系、必须要重写,父类的引用指向子类对象/** public class Parent{* 	public void eat(){System.out.println("Parent"); }* }* * public class Child1 extends Parent{* 	public void eat(){System.out.println("Child1");}* }* *  public class Child2 extends Parent{* 		public void eat(){System.out.println("Child2");}* }* * public class Grand1 extends Child1{* 	public void eat(){System.out.println("Grand1");}* }* * * public class Test{* 		public static void main(String[] args){* 			Parent xx=new Parent();* 			xx.eat();* 			xx=new Child1();* 			xx.eat();//执行Child1里的方法* * * 			aa(new Parent());* 			aa(new Child1());* 		}* 		public static void aa(Parent xx){* 			xx.eat();* 		}///强制类型转换 大碗不能自动转成小碗* Parent xx =new Grand1();* Child1 yy=(Child1)xx;* Child2 yy=(Child2)xx;//运行报错,xx内核为Grand类型数据* * 引用类型到底能不能转,做判断:* instanceof 判断xx是否位Child2类型的对象,或者Child2子孙后代的对象* if(xx instanceof Child2){* 	Child2 yy=(Child2)xx;* * }* * * int a=32;* short b=(short)a;* * int[] arr={100,2457,120,22};* for(int i=0;i<arr.length;i++){* 	char j =(char)arr[i];* 	System.out.println(j);* }* }*///基本数据类型/** int a=10;* Integer b=10;* * int Integer String * * int->Integer new Integer():* int a=10;* Integer a_p=new Integer(a);* * Integer->int intValue()* Integer a_p=new Integer(4);* int a=a_p.intValue();* * Integer->String toString();* Integer a_p=new Integer(4);* * * * String->/integer:new Integer()* String a="888";* Integer b=new Integer(a)* * int->String String.valueOf()* int a=10;* String b=String.valueOf(a);* * String->int Integer.parseInt()* String a="999";* int b=Integer.parseInt(a);* *///装箱:基本类型->包装类/** int a=10;* Integer i=Integer.valueOf(a);* 或Integer j=new Integer(a);*///拆箱 包装类->基本类型/** Integer k=new Integer(10);* int b=k.intValue();*///自动装箱 直接把一个int类型的数据直接赋值到Integer(java 5之后)/** int c=20;* Integer p_auto=a;* 或 Integer m=100;*///自动拆箱(把一个包装类型的数据变成基本类型数据)/** Integer l=new Integer(10);* int d_auto=l;*///128陷阱/** Integer num1=100;/=150 调的是valueOf方法,避免频繁创建 * Integer num2=100;/=150* System.out.println(num1==num2);true/false 超过128就是false* Integer num3=new Integer(100);* Integer num4=new Integer(100);*  System.out.println(num3==num4);false*  *  */}
package com.qc.Object;public class Test {public static void main(String[] args) {Object aa=new Object();aa.equals(obj);aa.hashCode();//equals()比较内存地址指向是否相同//getClass()获取类的信息 反射邻域//hashCode()获取散列码 根据地址生成//哈希表:数组+链表结构String a="ok";String b=new String("ok");Person x1=new Person();Person x2=new Person();System.out.println(x1.hashCode());//x1,x2的hashCode不同;a,b的hashCode相同,因为String重写了方法//(Objects里)equals判断是否为同一个对象;hashCode判断是否是同一类 大部分类在重写equals方法时会重写hashCode方法//如果两个对象相同(equals方法返回true),那么他们的hashCode值一定相同//如果两个对象不同(equals方法返回false),他们的hashCode值可能相同 可能不同//如果两个对象hashCode值相同(存在哈希冲突),他们可能相同可能不同(equals方法可能返回false,可能返回true)//如果两个对象hashCode值不同,那么他们两个肯定不同(equals方法返回false)//面试题1:两个不同的对象,hashCode有没有可能相同? 可能,有极小概率//面试题2:重写equals方法为什么要重写hashCode方法?一定要重写吗?//跟hashmap 如果不使用hashmap则不需要重写hashCode;equals和hashCode在hashmap里是配合使用的//hashmap比较key值的时候使用equals方法比较是否重复,存入values时要使用hashCode确定位置//访问权限修饰符(修饰变量/方法) 当前类       同包       子类 跨包    其他包//public                        ✔                ✔            ✔                   ✔//protected                     ✔                ✔            ✔                   ✖//默认  不写                    ✔                ✔              ✖                 ✖//private                       ✖                 ✖             ✖                 ✖//wait() 线程进入等待状态 让出CPU和锁//notify() 唤醒等待的线程//toString() 输出对象的类型和内存地址//hashCode()}
}

 "128陷阱"是Java中关于整数缓存机制的一个经典问题,主要涉及Integer类的缓存行为和自动装箱/拆箱机制。

  1. Integer缓存机制:

    • Java对-128127之间的Integer对象进行了缓存

    • 当使用自动装箱或Integer.valueOf()方法时,会优先从缓存中获取对象

底层原理

  1. IntegerCache类:

    • Java在Integer类内部维护了一个静态的IntegerCache

    • 默认缓存了-128到127之间的Integer对象

  2. 自动装箱行为:

    • 当使用Integer i = 100这样的语法时,实际调用的是Integer.valueOf(100)

    • valueOf()方法会先检查是否在缓存范围内

目的:

  • 减少对象创建:对于常用的小整数(-128~127),通过缓存复用对象,避免重复创建

http://www.dtcms.com/wzjs/28152.html

相关文章:

  • 成都做微信小程序的公司semseo
  • 安徽同济建设集团网站百度指数的搜索指数代表什么
  • 首次建设网站流程信息发布推广平台
  • 南水北调建设管理局网站网络营销简介
  • 263企业邮箱怎么样防疫管控优化措施
  • 这么做网站百度主页面
  • 快速制作app软件东莞seo网站管理
  • 三种WordPress引流方法免费seo网站诊断
  • 国外做的比较好的网站推广方案怎么写模板
  • 聊网站推广百度seo点击工具
  • 温州的网站建设公司广告软文
  • 有没有接单做加工的网站网站制作详细流程
  • 上海市城乡建设管理委员会网站厦门关键词优化企业
  • 做网站制作较好的公司网站优化外包找谁
  • 成都哪里有做网站建设的徐州seo网站推广
  • 网站开发设计前景网络seo招聘
  • 网站排名推广自己怎么做班级优化大师使用指南
  • 美国做爰视频网站重庆网站排名推广
  • 免费做任务赚钱的网站有哪些网络营销包括哪些
  • 响应式网站难做百度咨询
  • 电子商务网站建设与管理实训报告自动seo优化
  • 建网站商城有哪些公司怎么去做网络推广
  • 如何用网页设计制作个人网站seo推广骗局
  • 湖南网页设计培训网站建设app推广软件
  • 单位网站备案要等多久苏州关键词排名提升
  • 做网站设计的公司有哪些电商网站定制开发
  • 洛阳做网站排名狠抓措施落实
  • 如何自做自己的网站百度app安装
  • 如何做个免费的网站南阳本地网络推广优化公司
  • 网站受攻击成人就业技术培训机构