Skip to content

Commit 8e778f3

Browse files
committed
Java第二天
1 parent 0e5c44c commit 8e778f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+958
-0
lines changed

day02/ASCII码表.doc

52 KB
Binary file not shown.
36.5 KB
Binary file not shown.
576 Bytes
Binary file not shown.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
常量:在程序执行的过程中其值不可以发生改变
3+
举例:π
4+
5+
分类:
6+
A:字面值常量
7+
1,12.5
8+
B:自定义常量(面向对象部分讲解)
9+
10+
字面值常量分类:
11+
A:字符串常量 用""括起来的内容
12+
B:整数常量 所有的整数数据
13+
C:小数常量 所有的带小数的数据
14+
D:字符常量 用单引号括起来的内容
15+
E:布尔常量 只有两个值:true和false
16+
F:空常量 null(数组部分去讲解)
17+
*/
18+
class ConstantDemo {
19+
public static void main(String[] args) {
20+
//字符串常量
21+
System.out.println("HelloWorld");
22+
23+
//整数常量
24+
System.out.println(100);
25+
26+
//小数常量
27+
System.out.println(12.345);
28+
29+
//字符常量
30+
System.out.println('A');
31+
//下面的是错误的
32+
//System.out.println('BC');
33+
System.out.println('1');
34+
35+
//布尔常量
36+
System.out.println(true);
37+
System.out.println(false);
38+
}
39+
}
427 Bytes
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
二进制
3+
由0,1组成。以0b开头
4+
八进制
5+
由0,1,…7组成。以0开头
6+
十进制
7+
由0,1,…9组成。整数默认是十进制的
8+
十六进制
9+
由0,1,…9,a,b,c,d,e,f(大小写均可)。以0x开头
10+
11+
*/
12+
class JinZhiDemo {
13+
public static void main(String[] args) {
14+
System.out.println(0b100);//4
15+
System.out.println(0100);//64
16+
System.out.println(100);//100
17+
System.out.println(0x100);//256
18+
}
19+
}
2.22 MB
Binary file not shown.
2.22 MB
Binary file not shown.
2.22 MB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)