数据类型类拓展
import com.sun.management.VMOption;
public class DEMO03 {
public static void main(String[] args) {
//整数拓展 进制问题 二进制0b 十进制 八进制0 十六进制0x
int i = 10;
int i2 = 010; //八进制
int i3 = 0x16; //十六进制 0-9 A-F 16
System.out.println(i);
System.out.println(i2);
System.out.println(i3);
System.out.println("=============================================================");
//=============================================================
//浮点数拓展 银行业务怎么表示? 钱
//bigDecimal 数学工具类
//=============================================================
//float 有限的 离散的 浮点数存在一个舍入误差 只能是大约数 接近单不等于
//double
//最好完全使用浮点数进行比较
//最好完全使用浮点数进行比较
//最好完全使用浮点数进行比较 少去用浮点数去比较
float f = 0.1f; //0.1
double d = 1.0 / 10; //0.1
System.out.println(f == d); //俩等于号判断是否相等 反馈为false前面打个点点调试窗口 .
float d1 = 2312312323123132f;
float d2 = d1 + 1;
System.out.println(d1 == d2); //true
//=============================================================
//字符拓展?
//=============================================================
char c1 = 'A';
char c2 = '中';
System.out.println(c1);
System.out.println((int) c1);//强制转换
System.out.println(c2);
System.out.println((int) c2);//强制转换
//所有的字符本质还是数字
//char类型会涉及一个编码问题 编码 Unicode 表;97=a 65=A(处理各个语言文字) 2字节 最多可以表示 0-65536字符(不止这些) 最早的Excel表格可以表示2的16次方也就是65536
//会从U0000-UFFFF
char c3 = '\u0061';
System.out.println(c3);//a 可以输出a
//转义字符
// \t 制表符
// \n 换行
//..........
System.out.println("Hello\n World");
//=============================================================
System.out.println("=============================================================");
String sa = new String("hello world");
String sb = new String("hello world");
System.out.println(sa==sb);//false
String sc ="hello world";
String sd ="hello world";
System.out.println(sc==sd); //true
//学到对象 从内存分析
//布尔值扩展
boolean flag = true;
if (flag==true);{}//新手程序眼这样写
if (flag=);{} //老手 //这两行代码一样的都等于true
//less is More! 代码要精简易读