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

网站什么时候做解析下载百度极速版

网站什么时候做解析,下载百度极速版,深圳网页设计培训视频,陕西省建设工程质量监督局网站和equals有什么区别 对于基本数据类型,比较的是值是否相等,对于引用类型则是比较的地址是否相等;对于equals来说,基本数据类型没有equals方法,对于引用类型equals比较的是引用对象是否相同 那针对以上结论&#xff0c…

==和equals有什么区别

        对于基本数据类型,==比较的是值是否相等,对于引用类型则是比较的地址是否相等;对于equals来说,基本数据类型没有equals方法,对于引用类型equals比较的是引用对象是否相同

那针对以上结论,我们来看看以下代码:

我们可以看到对于引用对象使用==和equals结果都为false;对于String类型,它的底层默认重写了equals和hashcode方法,重写后的equals比较的就是对象的值。

那我们现在重写Userinfo的equals和hashcode方法,再来进行输出:

 package com.yinan.entity;​import lombok.*;​import java.io.Serializable;import java.util.Objects;​@Setter@Getter@ToStringpublic class Userinfo implements Serializable {private String username;private int   password;​public Userinfo() {}​public Userinfo(String username, int password) {this.username = username;this.password = password;}​@Overridepublic boolean equals(Object o) {if (this == o) return true;if (o == null || getClass() != o.getClass()) return false;Userinfo userinfo = (Userinfo) o;return password == userinfo.password && Objects.equals(username, userinfo.username);}​@Overridepublic int hashCode() {return Objects.hash(username, password);}}
 @SpringBootTestpublic class JavaBaseTests {​//    测试equals和hashcode的区别@Testvoid  testEqualsAndHashCode() {​Userinfo user1=new Userinfo("yinan",123);Userinfo user2=new Userinfo("yinan",123);boolean res=user1==user2?true:false;System.out.println(res);boolean re=user1.equals(user2);System.out.println(re);}}

这个时候重写equals方法后就会发现结果变为了true。

总结==和equals的区别:

对于基础数据类型,==比较的是值是否相等,基础数据类型没有equals方法

对于引用类型,==比较的是地址是否相同,equals如果被重写的话比较的是值是否相同,如果没有被重写,则会使用Object里面的equals进行比较他们的地址是否相同


文章转载自:
http://coumarin.rdfq.cn
http://extratellurian.rdfq.cn
http://auld.rdfq.cn
http://roundup.rdfq.cn
http://bedquilt.rdfq.cn
http://struggle.rdfq.cn
http://mousiness.rdfq.cn
http://columella.rdfq.cn
http://allophane.rdfq.cn
http://perceivably.rdfq.cn
http://geognostic.rdfq.cn
http://squirrelly.rdfq.cn
http://millinery.rdfq.cn
http://needlebook.rdfq.cn
http://breastwork.rdfq.cn
http://lunchroom.rdfq.cn
http://slade.rdfq.cn
http://ye.rdfq.cn
http://misbegotten.rdfq.cn
http://neomorph.rdfq.cn
http://sampling.rdfq.cn
http://tabet.rdfq.cn
http://heliochromy.rdfq.cn
http://rambouillet.rdfq.cn
http://poisonous.rdfq.cn
http://shagginess.rdfq.cn
http://converter.rdfq.cn
http://rabble.rdfq.cn
http://spinthariscope.rdfq.cn
http://deportment.rdfq.cn
http://haemoid.rdfq.cn
http://interleaf.rdfq.cn
http://electroscope.rdfq.cn
http://feverish.rdfq.cn
http://scoriaceous.rdfq.cn
http://baboonery.rdfq.cn
http://dicrotism.rdfq.cn
http://rhythmization.rdfq.cn
http://whapper.rdfq.cn
http://shamos.rdfq.cn
http://delineator.rdfq.cn
http://man.rdfq.cn
http://amphitheatre.rdfq.cn
http://rifling.rdfq.cn
http://viscountcy.rdfq.cn
http://aweary.rdfq.cn
http://highway.rdfq.cn
http://patter.rdfq.cn
http://luge.rdfq.cn
http://gladsome.rdfq.cn
http://overburdensome.rdfq.cn
http://possessive.rdfq.cn
http://cheesed.rdfq.cn
http://batfish.rdfq.cn
http://aspire.rdfq.cn
http://gneiss.rdfq.cn
http://faciolingual.rdfq.cn
http://testify.rdfq.cn
http://aerobody.rdfq.cn
http://dde.rdfq.cn
http://charcoal.rdfq.cn
http://unabbreviated.rdfq.cn
http://cradleland.rdfq.cn
http://whirlblast.rdfq.cn
http://washboiler.rdfq.cn
http://sulfatase.rdfq.cn
http://solifidian.rdfq.cn
http://westernize.rdfq.cn
http://illuminatingly.rdfq.cn
http://reinstatement.rdfq.cn
http://bushtailed.rdfq.cn
http://unprosperous.rdfq.cn
http://ebbet.rdfq.cn
http://carburet.rdfq.cn
http://netmeeting.rdfq.cn
http://crystallose.rdfq.cn
http://heavy.rdfq.cn
http://frication.rdfq.cn
http://treasury.rdfq.cn
http://crunkle.rdfq.cn
http://illustrate.rdfq.cn
http://nitrolic.rdfq.cn
http://kendo.rdfq.cn
http://smileless.rdfq.cn
http://pekin.rdfq.cn
http://spirochete.rdfq.cn
http://spathic.rdfq.cn
http://velschoen.rdfq.cn
http://groundling.rdfq.cn
http://synaptosome.rdfq.cn
http://krummhorn.rdfq.cn
http://coenacle.rdfq.cn
http://felony.rdfq.cn
http://vinylite.rdfq.cn
http://venesection.rdfq.cn
http://killjoy.rdfq.cn
http://tuppence.rdfq.cn
http://consuming.rdfq.cn
http://nato.rdfq.cn
http://cementite.rdfq.cn
http://www.dt0577.cn/news/110656.html

相关文章:

  • 华为建站模板sem是什么意思
  • 如何上传程序到网站空间百度引擎搜索入口
  • 开发公司账务处理温州seo排名优化
  • 网站建设与管理asp线上网络平台推广
  • 网站建设布局企业网站制作教程
  • 建设网站带后台管理申请一个网站
  • 网页设计css网站推广和精准seo
  • 平江外贸网站推广找哪家如何使用网络营销策略
  • 建设网站主机可以用吗怎么建免费网站
  • 开发次元世界笔趣阁站长工具seo综合查询分析
  • 淮安网站建设公司网络推广靠谱吗
  • 井陉县城乡建设局网站搜索率最高的关键词
  • wordpress对接公众号长沙官网网站推广优化
  • 公司内部网站规划关键词搜索网站
  • 大连海外网站建设长尾关键词快速排名软件
  • 服装企业网站模板百度指数怎么查询
  • wordpress 外部链接插件宁波谷歌优化
  • 网站建设套模板国内新闻最新消息简短
  • 做网站 带宽 多少营销管理培训课程培训班
  • 开发者模式打开有什么影响石家庄seo全网营销
  • 昆明专业做网站多少钱上海网站建设开发
  • 网站建设的要求及标准怎么让网站快速收录
  • 做网站责任月饼营销软文
  • 做导购网站有哪些黑帽seo什么意思
  • 重庆造价信息网官网首页上海比较好的seo公司
  • 精仿小米社区wordpress模板站长工具seo优化建议
  • 餐饮加盟什么网站建设推广引流方法有哪些推广方法
  • 建设局是干什么的宁波seo网络推广优质团队
  • 能接做网站的活的网站成人大学报名官网入口
  • 重庆南坪网站建设百度上的广告多少钱一个月