八大基本数据类型: 1.char 2个字节 2.boolean 1个字节 3.byte 1个字节 4.short 2个字节 5.int 4个字节 6.long 8个字节 7.float 4个字节 8.double 8个字节 引用类型: 1.类 2.接口 3.数组 Java是强类型语言。 进制: 二进制、八进制、十进制、十六进制 常见的转义字符 \t:制表符 \n:换行符 字符的比较 String sa = new String(“hello world!”); String sb = new String(“hello world!”); System.out.println(sasb);//false String sc = “hello world!”; String sd = “hello world!”; System.out.println(scsd);//true 类型转换 内存溢出 强制类型转换 (类型)变量名 高–低 自动转换 低–高 注意点: 1.不能对布尔值进行转换 2.不能把对象类型转换为不相干的类型 3.再把高容量转换为低容量时,强制转换 4.转换的时候可能存在内存溢出,或者精度问题 //操作比较打的数的时候,注意溢出问题 //JDK7新特性,数字之间可以用下划线分割 int money = 10_0000_0000; int years = 20; int total = moneyyears; System.out.println(total);//-1474836480 long total1 = money(long)years; System.out.println(total1);//20000000000