Download presentation
Presentation is loading. Please wait.
1
Computers & Programming Languages
2
Relational & Logical Operators
Lesson2- Objectives Examine relational and logical operators Explore how to form and evaluate logical Boolean expressions
3
Operators that allows you to make comparisons in a program.
Relational Operators Operators that allows you to make comparisons in a program.
4
Tip to Remember .. What is the difference between the two following operators ( = = and = )? = = determines two equations are equal = assigns a value of an expression to variable
5
What is the output of the following expressions if M = 6, D= 3, L=5
Task 1 What is the output of the following expressions if M = 6, D= 3, L=5 Expression Output System.out.println (M >= D); System.out.println (L > D); System.out.println (D > M); System.out.println (5 == ‘5’); System.out.println (8 <=5); System.out.println (M != L); true True False Work in pairs and answer activity P-215
6
Logical operators True True ! True True False True False
7
Evaluate each of the following expressions:
Book Activity P-217 Evaluate each of the following expressions: Expression Output (18>=16) && (‘D’ <‘E’) (17 >=15) && (‘J’ <‘D’) (14>=5) | | (‘A’ >’B’) !(14>=5) | | (‘A’ > ‘B’) true False True
8
Order of precedence
9
Book Activity P219 true False True
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.