没有合适的资源?快使用搜索试试~ 我知道了~
Java Methods-Boolean Expressions and if-else Statements.ppt
0 下载量 31 浏览量
2023-09-05
00:12:11
上传
评论
收藏 498KB PPT 举报
温馨提示
试读
30页
Java Methods-Boolean Expressions and if-else Statements.ppt
资源推荐
资源详情
资源评论
Boolean Expressions and if-else
Statements
if (chapter == 6)
Java Methods
Java Methods
Object-Oriented Programming
and Data Structures
6-2
Objectives:
• Learn about the boolean data type
• Learn the syntax for if-else statements
• Learn about relational and logical operators,
De Morgan’s laws, short-circuit evaluation
• Learn when to use nested if-else statements,
if-else-if sequences, the switch statement
• Learn about enum data types
6-3
if-else Statement
if ( <condition> )
{
< statements >
}
else
{
< other statements >
}
if ( <condition> )
{
< statements >
}
else clause
is optional
6-4
boolean Data Type
• George Boole (1815 - 1864)
• boolean variables may have
only two values, true or false.
• You define boolean fields or
boolean local variables the
same way as other variables.
boolean
true
false
Reserved words
private boolean hasMiddleName;
boolean isRolling = false;
6-5
Boolean Expressions
• In if (<condition> ) <condition> is a Boolean
expression.
• A Boolean expression evaluates to either
true or false.
• Boolean expressions are written using
boolean variables and relational and logical
operators.
剩余29页未读,继续阅读
资源评论
珞瑜·
- 粉丝: 10w+
- 资源: 500
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功