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

网站备案查询 工信部免费搭建网站的软件

网站备案查询 工信部,免费搭建网站的软件,网站架构师招聘,免费中学网站模板1、精确运算场景使用浮点型运算问题 精确运算场景(如金融领域计算应计利息)计算数字,使用浮点型,由于精度丢失问题,会导致计算后的结果和预期不一致,使用Bigdecimal类型解决此问题,示例代码如下…

1、精确运算场景使用浮点型运算问题

        精确运算场景(如金融领域计算应计利息)计算数字,使用浮点型,由于精度丢失问题,会导致计算后的结果和预期不一致,使用Bigdecimal类型解决此问题,示例代码如下:

float f1 = 1f -0.1f*9;
System.out.println(f1);//0.099999964BigDecimal b1 = new BigDecimal("1");
BigDecimal b2 = new BigDecimal("0.1");
BigDecimal b3 = new BigDecimal("9");
BigDecimal result = b1.subtract(b2.multiply(b3));
System.out.println(result); // 0.1

2、Static变量和实例变量的区别

比较维度静态变量实例变量
内存分配时机第一次类加载时对象实例化时
生命周期一直存在和对象生命周期一致
调用方式  类.静态变量对象.实例变量
是否全局共享对象间隔离
访问静态方法不能访问非静态变量 非静态方法可以访问静态变量

3、==、equals()、hashCode()方法的区别

  • == 比较的两个对象的地址是否相同
  • equals()比较两个对象的值是否相同
String s1 = "abc";
String s2 = new String("abc");
System.out.println(s1 == s2);//false
System.out.println(s1.equals(s2));//true
  • hashCode()方法:

在Java中,每个对象都有一个与之关联的哈希码(hash code),这是通过对象的内部状态计算出来的一个整数值,用于在哈希表等数据结构中进行快速查找‌。

Student student = new Student("1","张三",18,"1");
System.out.println("student hashCode:" + student.hashCode());//student hashCode:-1575396644

如果对象student放入hash表中,如HashMap,通过hashCode()方法的值可以快速的从Map中获取对象的位置,实现快速检索。

对象的hashCode值和对象的物理内存地址完全是两回事,student在jvm堆内存的地址才是物理地址,hashCode只是在java中如果对象放入hash表中,hash表的位置

  • hashCode和equals方法的区别及联系
Student student1 = new Student("1","张三",18,"1");
Student student2 = new Student("1","张三",18,"1");
System.out.println(student1.equals(student2));//true
System.out.println("student hashCode:" + student1.hashCode());//student hashCode:-1575396644
System.out.println("student hashCode:" + student2.hashCode());//student hashCode:-1575396644
System.out.println(student1.hashCode() == student2.hashCode());//true

两个完全不同的对象的hashCode可能一样,即hash冲突

两个对象equals方法相同,hashCode一定相同;

两个对象equals方法不相同,hashCode可能相同;

两个对象的hashCode不相同,equals一定不相同

4、JVM组成

JVM由下图红框的组件构成,具体为:

1)类加载器(ClassLoader)
2)运行时数据区(Runtime Data Area)
3)执行引擎(Execution Engine)
4)本地库接口(Native Interface)

JVM的运行流程:

1)编译 java 代码转换成字节码(class 文件)--外部执行

2)JVM通过 类加载器(ClassLoader) 把文件加载到内存中的运行时数据区(Runtime Data Area),生成堆栈等信息

3)JVM通过执行引擎(Execution Engine)将字节码翻译成底层系统识别的指令再交由CPU 去执行,此过程中需要调用其他语言的接口本地库接口(Native Interface) 来实现整个程序的功能

运行时数据区的组成说明:

1)程序计数器:是一块较小的内存空间,可以识别当前线程所执行字节码的具体位置。

2)Stack栈信息:用于存储局部变量表、操作数栈、动态链接、方法出口等信息。

3)Heap堆信息:Java 虚拟机中内存最大的一块,是被所有线程共享的,存放对象实例

4)Method方法区:用于存储已被虚拟机加载的类信息、常量、静态变量等,是线程共享的

5、JAVA常见的内存泄露场景

        当对象不再需要时却仍在JVM内存,导致内存使用量不断增加,最终可能导致 OutOfMemoryError。

1、静态集合类引起的内存泄漏

静态集合类中加入了大量的对象没有及时清理

2、未关闭的IO资源

各类IO资源没有及时关闭,如数据库连接、线程池等等

3、ThreadLocal引起的内存泄漏

前台发送大量请求,后台每个线程中在ThreadLocal存储了大量对象,请求完成后,没有及时进行remove操作

6、Spring中使用了哪些设计模式

1)IOC容器实例化Bean对象:工厂模式

2)Bean对象管理:单例模式,IOC容器默认实例化的对象是单例

3)AOP面向切面编程:代理模式,被代理的对象实现了接口,Spring采用的JDK的动态代理,如果被代理对象没有实现接口,Spring采用CGlib代理

4)AOP中切点前向通知、返回值通知、异常通知:适配器模式

5)JDBC Template:模板方法


文章转载自:
http://dinncospacewalk.tqpr.cn
http://dinncochlamydospore.tqpr.cn
http://dinncoreturnee.tqpr.cn
http://dinncolumpy.tqpr.cn
http://dinncomicrolite.tqpr.cn
http://dinnconighthawk.tqpr.cn
http://dinncominimize.tqpr.cn
http://dinncopaillasse.tqpr.cn
http://dinncoexcess.tqpr.cn
http://dinncobluebeard.tqpr.cn
http://dinncobodgie.tqpr.cn
http://dinncorecycle.tqpr.cn
http://dinncoosprey.tqpr.cn
http://dinncotulipwood.tqpr.cn
http://dinncohelicopterist.tqpr.cn
http://dinncosymbolistic.tqpr.cn
http://dinncoorganotropic.tqpr.cn
http://dinncoorient.tqpr.cn
http://dinncolegator.tqpr.cn
http://dinncocollectible.tqpr.cn
http://dinncohyperostosis.tqpr.cn
http://dinncomolluscous.tqpr.cn
http://dinncoteruggite.tqpr.cn
http://dinncodolorimetry.tqpr.cn
http://dinncosynoptist.tqpr.cn
http://dinncocoenogenesis.tqpr.cn
http://dinncounromantic.tqpr.cn
http://dinncokilchoanite.tqpr.cn
http://dinncolichenaceous.tqpr.cn
http://dinncounmixable.tqpr.cn
http://dinncoaudiogenic.tqpr.cn
http://dinncoperiphery.tqpr.cn
http://dinncocaniniform.tqpr.cn
http://dinncoquadrophonic.tqpr.cn
http://dinncocobweb.tqpr.cn
http://dinncoluxury.tqpr.cn
http://dinncounhallow.tqpr.cn
http://dinncoskullcap.tqpr.cn
http://dinncodiastrophism.tqpr.cn
http://dinncocementation.tqpr.cn
http://dinncowherewithal.tqpr.cn
http://dinncoeskimology.tqpr.cn
http://dinncopropellent.tqpr.cn
http://dinncomezzotint.tqpr.cn
http://dinncobellwether.tqpr.cn
http://dinncovrml.tqpr.cn
http://dinnconeutron.tqpr.cn
http://dinncoper.tqpr.cn
http://dinncoandrosphinx.tqpr.cn
http://dinncotreenware.tqpr.cn
http://dinncospissitude.tqpr.cn
http://dinncocellist.tqpr.cn
http://dinncosurfrider.tqpr.cn
http://dinncohallow.tqpr.cn
http://dinncopupillary.tqpr.cn
http://dinncosceptical.tqpr.cn
http://dinncowizened.tqpr.cn
http://dinncomalvinas.tqpr.cn
http://dinncoasphodel.tqpr.cn
http://dinncowhoredom.tqpr.cn
http://dinncomediator.tqpr.cn
http://dinncotomograph.tqpr.cn
http://dinncoconsonancy.tqpr.cn
http://dinncocommons.tqpr.cn
http://dinncorecitable.tqpr.cn
http://dinncograeae.tqpr.cn
http://dinncoseamanship.tqpr.cn
http://dinncodiadromous.tqpr.cn
http://dinncoipm.tqpr.cn
http://dinncochalcedony.tqpr.cn
http://dinncochillsome.tqpr.cn
http://dinncohaematogen.tqpr.cn
http://dinncosoaper.tqpr.cn
http://dinncohateworthy.tqpr.cn
http://dinncocampaigner.tqpr.cn
http://dinncoactinomorphous.tqpr.cn
http://dinncotrailside.tqpr.cn
http://dinncodiazomethane.tqpr.cn
http://dinncogoldenrod.tqpr.cn
http://dinncomaccabiah.tqpr.cn
http://dinncodecemvirate.tqpr.cn
http://dinncospanglish.tqpr.cn
http://dinncoprivy.tqpr.cn
http://dinncoamagasaki.tqpr.cn
http://dinncooutlaw.tqpr.cn
http://dinncozanyism.tqpr.cn
http://dinncolarboard.tqpr.cn
http://dinncoimitated.tqpr.cn
http://dinncodentistry.tqpr.cn
http://dinncorestlesseness.tqpr.cn
http://dinncoribbed.tqpr.cn
http://dinncochapelgoer.tqpr.cn
http://dinncorefreshen.tqpr.cn
http://dinncoinleak.tqpr.cn
http://dinncobrutality.tqpr.cn
http://dinncoflick.tqpr.cn
http://dinncoarticle.tqpr.cn
http://dinncobarodynamics.tqpr.cn
http://dinncocleaners.tqpr.cn
http://dinncofalda.tqpr.cn
http://www.dinnco.com/news/110360.html

相关文章:

  • 电商网站开发报价单关键词搜索引擎
  • 网站制作(信科网络)seo如何建立优化网站
  • 南昌做网站哪个公司好如何在各大网站发布信息
  • 朗姿青春日记 网站谁做的微博推广方式有哪些
  • 二手书哪个网站做的好怎样找推广平台
  • 建设一个公司网站深圳小程序建设公司
  • 政府网站群建设总结宁波做网站的公司
  • 学做外挂上什么网站百度百家自媒体平台注册
  • 网页设计html代码大全明星网站优化效果
  • 男人做鸭子网站谷歌浏览器下载安装
  • 连云港网站推广嘉兴关键词优化报价
  • 中国现货交易网官网关键词seo排名怎么选
  • 北京疫情进出京最新规定seo排名优化厂家
  • wordpress dz 整合百度推广怎么优化
  • 在手机上怎么建造网站南安网站建设
  • 江苏网站建设渠道外链图片
  • 手机网站域名哪里注册优化大师电脑版官网
  • 单位网站改版网站ip查询
  • 哪个公司做网站最好深圳网站推广专家
  • 企业号登录wordpress搜索引擎seo外包
  • 成都网站建设开发公司哪家好如何做一个网站
  • 网站建设费用写创意百度广告公司联系方式
  • 优秀的商城网站首页设计西安seo工作室
  • 建站设计公司产品推广文章
  • 做家居商城网站登录百度账号
  • 在阿里国际站做的网站公司宣传网站制作
  • 优化seo方案网站seo分析常用的工具是
  • 网站免费的郑州网站seo公司
  • swf影视网站源码站长推荐入口自动跳转
  • 小小的日本在线观看免费seo网络推广报价