/**
* @author LeapingQuantum
*/
public class Const {
public static void main(String[] args) {
// 字符串常量
System.out.println("String constant 1");
System.out.println("");
System.out.println("String constant 2");
// 整数常量
System.out.println(30);
System.out.println(-500);
// 浮点数常量
System.out.println(3.14);
System.out.println(-2.5);
// 字符常量
System.out.println('a');
System.out.println('0');
// 布尔常量
System.out.println(true);
System.out.println(false);
// 空常量(不能直接用来打印输出)
// System.out.println(null);
}
}
运行结果:
String constant 1
String constant 2
30
-500
3.14
-2.5
a
0
true
false