Java
Table of Contents
注释..................................................................................................................................................2
单行注释.............................................................................................................2
多行注释,可以横跨多行:........................................................................................2
输入和输出..........................................................................................................................................2
输入..................................................................................................................2
输出..................................................................................................................3
数据类型.............................................................................................................................................3
字符..................................................................................................................3
整数值................................................................................................................3
浮点数值.............................................................................................................3
布尔..................................................................................................................3
字符串................................................................................................................3
对于+的一些讨论...................................................................................................................................3
printf().............................................................................................................................................4
变量和常量..........................................................................................................................................4
变量..................................................................................................................4
常量..................................................................................................................4
语句..................................................................................................................................................4
运算符................................................................................................................................................5
算术运算符..........................................................................................................5
关于自增和自减运算符的说明................................................................................................... 5
关系运算符..........................................................................................................5
逻辑运算符..........................................................................................................5
短路...................................................................................................................................... 6
位运算符.............................................................................................................6
赋值运算符 =.......................................................................................................6
复合赋值运算符...................................................................................................................... 6
条件运算符 ?:......................................................................................................6
逗号运算符 ,........................................................................................................7
运算符的优先级.....................................................................................................7
分支..................................................................................................................................................7
if..................................................................................................................... 7
if...else............................................................................................................7
case.................................................................................................................7
if 和 switch 的区别和选择........................................................................................8
循环..................................................................................................................................................8
while................................................................................................................8
for...................................................................................................................8
for (var i = 1; i <= 10; i++)................................................................................8
do...while.........................................................................................................8
三种循环结构的比较................................................................................................9
概念..................................................................................................................9
break、continue、goto 和标签.............................................................................................................9
break...............................................................................................................9
continue...........................................................................................................9
标签..................................................................................................................9
goto...............................................................................................................10
var 和 8 个基本类型..............................................................................................................................10
关于类型的常见的错误:.........................................................................................10
var 和基本类型在声明变量时的区别............................................................................10
数据类型之间的转换..............................................................................................11