65-lecture07

# 65-lecture07 - Computer Science 65 Intro to CS If-Else...

This preview shows pages 1–10. Sign up to view the full content.

Computer Science 65 Intro to CS February 14, 2008 If-Else Statements Loops

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Presentations February 14 Lance Berg GPS February 19 Computer Science Applications in Sports February 21 Tim Crane Robotics
Announcements If you did homework on lab machines, submit the homework by emailing me your .java file If you need an extension for homework #3, please talk to me Typically, homework receives a 10% late penalty a day Next programming assignment will be handed out on Tuesday

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Logical Operators Java provides two binary logical operators ( and || ) that are used to combine boolean expressions. Java also provides one unary ( ! ) logical operator to reverse the truth of a boolean expression.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Logical Operators Operator Meaning Effect AND Connects two boolean expressions into one. Both expressions must be true for the overall expression to be true. || OR Connects two boolean expressions into one. One or both expressions must be true for the overall expression to be true. It is only necessary for one to be true, and it does not matter which one. ! NOT The ! operator reverses the truth of a boolean expression. If it is applied to an expression that is true, the operator returns false. If it is applied to an expression that is false, the operator returns true.
notes

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
boolean a = 4<5; boolean b = (5 == 3); boolean c; boolean d; c = a & b; d = a || b; && returns true when both a and b are _____ ; Otherwise, returns _______ || returns true when either a or b is _____; If both a and b are false , returns ______
Both operators, && ||, performs __________________________ The boolean expression on the left hand side of && (or ||) is evaluated first

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/02/2008 for the course CS 065 taught by Professor Urness during the Spring '08 term at Drake University .

### Page1 / 36

65-lecture07 - Computer Science 65 Intro to CS If-Else...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online