forked from CPU-Code/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstant.java
More file actions
69 lines (58 loc) · 1.44 KB
/
Copy pathConstant.java
File metadata and controls
69 lines (58 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package src.variable;
/*
常量:
在程序运行过程中,其值不可以发生改变的量。
常量分类:
字符串常量: 用双引号括起来的内容。"HelloWorld"
整数常量: 不带小数的数字。666,-88
小数常量: 带小数的数字。13.14,-5.21
字符常量: 用单引号括起来的内容。'A','0','哈'
布尔常量: 布尔值,表示真假。true,false
空常量: 一个特殊的值,空值。null
*/
public class Constant {
public static void main(String[] args){
//字符串常量
System.out.println("哈哈");
System.out.println("cpu_code");
System.out.println("--------");
//整数常量
System.out.println(666);
System.out.println(-88);
System.out.println("--------");
//小数常量
System.out.println(13.14);
System.out.println(-5.21);
System.out.println("--------");
//字符常量
System.out.println('C');
System.out.println('0');
System.out.println('哈');
System.out.println("--------");
//布尔常量
System.out.println(true);
System.out.println(false);
System.out.println("--------");
//空常量
//空常量是不能直接输出的
//System.out.println(null);
}
}
/*
哈哈
cpu_code
--------
666
-88
--------
13.14
-5.21
--------
C
0
哈
--------
true
false
--------
* */