public class DataTypeDemo{ public static void main(String[] args){ byte b = 10; byte c = 127;
//int i = 3111111111; 报错
long a = 3111111111L;
float f1 = 3.1234567123f;
float f2 = 3.12345671233243443f; System.out.println(f1 == f2);
//字符类型
//char ch = ‘ab’; 错误
//字符串类型,是一个字符序列
String s = “ab”;
char ch = ‘a’;
System.out.println(ch == 97); //char d = ‘\t’;
char e = ‘\u0009’;
System.out.println("[" + e + “]”); System.out.println("“你好”");
char ch1 = ‘A’; boolean aa = true; System.out.println((ch1 == 65) == aa);
}
}
2021-11-12
最新推荐文章于 2025-03-17 15:48:33 发布