- 4
- 0
- 约 6页
- 2017-03-06 发布于广东
- 举报
4运算符、表达和流程控制
运算符、表达式和流程控制
1.运算符
运算符是用于标记对数据执行某种运算的特定符号
2.按运算性质分类:
算术运算符:+,-,*,/,%
关系运算符: , , , , ,!
布尔运算符:!,,|,^,,||
位运算符:,|,^,~ , , , 赋值运算符: 及扩展赋值运算符(+ ,- ,* ,/ ,…)
其他运算符:+,-,?: ,++,--
3.按操作数的个数分类:
单目运算符
双目运算符
三目运算符
4.表达式
1 表达式是符合一定语法规则的运算符和操作数的序列 。
2 表达式的类型和值
对表达式中操作数进行运算得到的结果称为表达式的值
表达式的值的数据类型即为表达式的类型
3 表达式的运算顺序
首先应按照运算符的优先级从高到低的顺序进行
优先级相同的运算符按照事先约定的结合方向进行
4 运算符优先级/结合方向
5 表达式中的数值类型转换
自动类型转换
强制类型转换
数值类型间转换途径
5.程序运行流程
按照运行流程来划分,程序可分为三种基本结构——顺序结构、分支结构和循环结构。
1 顺序结构:按照语句出现的顺序依次执行的程序结构
2 分支结构:分支结构也称选择性结构,有条件地执行或跳过特定的语句或语句块,实现有选择的流程控制
3 循环结构:在一定的条件下重复执行特定代码。
6.分支语句
1 if-else语句
if-else语句用于实现分支结构,其中的else子句不是必须的,if-else语句又可细分为三种形式:
单路分支结构
语法格式:
if B.双路分支结构
语法格式:
if else C.多路分支结构
语法格式:
if else if …
else if [else
语句n+1 ]
2 switch语句用于实现简单的多路分支结构
语法格式:
说明:
A.switch后的 必须是下述几种类型之一:int, byte, char, short,枚举类型和封装类类型;
B.case子句中的常量值不得重复;
C.default子句是任选的;
D.break语句用来在执行完一个case分支后使程序跳出switch语句块;
循环语句
for循环
while循环
do-while循环
for-each循环
循环的嵌套
流程控制语句break和continue
break语句用于终止所在switch块或循环语句的运行
continue语句用于结束所在的循环语句的本次运行,即跳过其后的循环体语句,开始下一次循环。
and due diligence evaluations article 22nd head office, branch jurisdiction , risk management, marketing management branch within the Departments credit business person assumed responsibility for the supervision and inspection and due diligence evaluations. Article 23rd, Head Office, branches jurisdiction , risk management, Marketing Management Department through on-site and off-site inspection, investigation report, interviews with investigators for pre-loan investigation work by way of conducting supervision and inspection, quality evaluation pre-loan investigation work, and based on the evaluation results, the implementation of diversity management. 24th the control and inspection a the implementation of the credit system: there is no breach of credit policy relating to the granting of credit and the head office; B dual credit rating: timeliness of ratings, whether the provisions of the rating, rating results are accurate; C the survey co
原创力文档

文档评论(0)