北京动力节点 http://www.bjpowernode.com
1、纲要............................................................................................................................................. 2
2、内容............................................................................................................................................. 2
2.1、标识符 .............................................................................................................................. 2
2.2、关键字 .............................................................................................................................. 2
2.3、数据类型 .......................................................................................................................... 3
2.3、进制换算 .......................................................................................................................... 4
2.4、字符编码 .......................................................................................................................... 4
2.5、变量 .................................................................................................................................. 5
2.6、数据类型详解 .................................................................................................................. 6
2.6.1、整数型 ................................................................................................................... 6
2.6.2、浮点类型 ............................................................................................................... 7
2.6.3、布尔类型 ............................................................................................................... 7
2.6.4、基本类型的转换 ................................................................................................... 8
2.7、运算符 ............................................................................................................................ 11
2.6.1、算术运算符 ......................................................................................................... 11
2.7.2、关系运算符和布尔运算符 ................................................................................. 13
2.7.3、赋值类运算符 ..................................................................................................... 14
2.7.4. 条件运算符 .......................................................................................................... 14
2.8、控制语句 ........................................................................................................................ 15
2.8.1、if 语句和 if else 语句 .......................................................................................... 15
2.8.2、switch 语句 ......................................................................................................... 17
2.8.3、for 语句 ............................................................................................................... 18
2.8.4、while 语句 ........................................................................................................... 19
2.8.5、do while 语句 ...................................................................................................... 20
2.8.6、break 语句 ........................................................................................................... 21
2.8.7、continue 语句 ...................................................................................................... 21
2.9、方法初步 ........................................................................................................................ 22
2.9.1、普通方法示例 ..................................................................................................... 22
2.9.2、方法的重载(Overload) .................................................................................. 24
3.0、递归问题 ........................................................................................................................ 26
3、练习题....................................................................................................................................... 29