rec4 - CS 177 Week 4 Recitation Slides Conditionals 1...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS 177 Week 4 Recitation Slides Conditionals
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Announcements Project 1 is due on Feb. 7th 9pm (extended) Project 2 will be posted today (Feb. 5th) Exam 1 next Thursday
Background image of page 2
3 QUESTIONS???
Background image of page 3

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

View Full DocumentRight Arrow Icon
x++ vs. ++x x = 0; y = (x++) + 1; => x = 1 and y = 1 y = x + 1; x += 1; y = (++x) + 1; => x = 1 and y = 2 x += 1; y = x + 1; 4
Background image of page 4
Conditions in the if Any expression that evaluates to a boolean is legal in an if-statement Comparisons x > y length == 10 Methods returning a boolean str1.equals(str2) Chatacter.isDigit(gender) A boolean true isHard (boolean variable) 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
Equality Is it fine to use == to represent equality? Correct int char anything else you can list? Wrong double String everything started with an uppercase letter 6
Background image of page 6
Exclusivity if (condition) statement1; else statement2; statement1 and statement2 can not both be executed Either statement1 or statement2 will be executed Also, statement1 and statement2 can be statement blocks instead of a single statement 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 18

rec4 - CS 177 Week 4 Recitation Slides Conditionals 1...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online