Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computers & Programming Languages

Similar presentations


Presentation on theme: "Computers & Programming Languages"— Presentation transcript:

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


Download ppt "Computers & Programming Languages"

Similar presentations


Ads by Google