public class Demo1 {
public static void main(String[] args) {
//整数拓展 进制: 二进制0b 十进制 八进制0 十六进制0x
int i0 = 10;
int i1 = 010;
int i2 = 0x10;
int i3 = 0b10;
System.out.println(i0);
System.out.println(i1);
System.out.println(i2);
System.out.println(i3);
System.out.println("=============");
// 浮点数拓展
// float 有限 离散 舍入误差 大约 接近但不等于
// double
float f = 0.1f;
double d = 1.0 / 10;
System.out.println(f==d);
float f1 = 324354654f;
float f2 = f1 + 1;
System.out.println(f1==f2);
System.out.println("==============");
//字符型拓展
char ch1 = 'a';
char ch2 = '中';
System.out.println(ch1);
System.out.println((int)ch1);
System.out.println(ch2);
System.out.println((int)ch2);
//所有字符本质还是数字
//编码Unicode 0-65535, 97 = a, 65 = A
//U0000---UFFFF
char ch3 = '\u0061';
System.out.println(ch3);
System.out.println("==============");
//转义字符
// 制表符\t 换行\n
System.out.println("Hello \t World");
// 对象 从内存中分析不相等
String st1= new String("hello word");
String st2 = new String("hello word");
System.out.println(st1==st2); // false
// flag
boolean flag = true;
if(flag == true) {}
if(flag) {}
}
}