public class demo02 {
public static void main(String[] args) {
//八大基本数据类型
//整数
int num1 = 10;
byte num2 = 20;
short num3 = 30;
long num4 = 40L;
//小数:浮点数
float num5 = 10.3F;
double num6 = 3.14159;
//字符
char name1 = '中';
//字符串
String name2 = "中国";
//布尔值
boolean flag = true;
//整数拓展
int i = 10;
int i2 = 010;
int i3 = 0x10;
System.out.println(i);//10
System.out.println(i2);//8
System.out.println(i3);//16
//浮点数拓展
//最好完全避免用浮点数进行比较
float f = 0.1f;
double d = 1.0/10;
System.out.println(f==d);//false
float d1 = 21313132131f;
float d2 = d1+1;
System.out.println(d1==d2);//true
//字符拓展
char c1 = 'A';
char c2 = '中';
System.out.println(c1);//A
System.out.println(c2);//中
System.out.println((int)c1);//65
System.out.println((int)c2);//20013
//转义字符
//\t制表符
//\n换行
//布尔值拓展
boolean flag1 = true;
if (flag1==true){}//新手
if (flag1){}//老手
}
}