2021.12.2 重新开始

float f = 0.1f; //0.1

double d = 1.0/10; //0.1 

System.out.println(f==d); //false

基本数据类型比较的是值,引用数据类型比较地址

float d1 = 2312312311313f;

float d2 = d1+1;

System.out.println(f==d); //true

最好避免使用浮点数进行比较

char c1 = 'a';

char c2 = '中';

System.out.println(c1);  a

System.out.println((int)c1);//强制转换  97

System.out.println(c2);  中

System.out.println((int)c2);//强制转换  20013

所有的字符本质还是数组

原文地址:https://www.cnblogs.com/xujing0808/p/15631497.html