[CS 0401] - Final Exam Guide - Everything you need to know! (36 pages long)

380 views36 pages
29 Mar 2017
School
Course
Professor

Document Summary

Can use relational operators tests for the truth between the values. Must express true or false on both sides. The operators will not change the value, they just create a temporary copy of the value. When mixing boolean and relational operators relational operators have higher priority than boolean operators. Short circuiting the result can be determined before the entire expression has been examined. it with null. How does short circuiting save us? anything is false) finding the length of something that doesn"t exist. If you reverse the line of code, because it will read left to right, it will not short circuit, and it will crash. This means that there is no string, so it will replace. When you have a false && scenario the expression is already false. (false and. This will crash your program tried to do an impossible thing by. // do stuff if (s != null && s. length() > 5) count++;