CS 1410 Lecture Notes - Lecture 3: Boolean Expression
Document Summary
If using an integer variable, the decimals are dropped (not rounded) Character a : single quotes for single letters, a + 1 = 66. A is converted to unicode representation (65) when used in a calculation: (char) ( a + 1) = b . Result of calculation is converted to the type in parenthesis. Booleans cannot be converted: only hold true or false (lower case, boolean issnowing; issnowing = false; Flags: testing a program, boolean didpass = score >= 70; Tests objects to see if they are the same object: objects (such as strings) can only be tested for equality, (x >= 5) && (x <= 10) && is and (both expressions must be true for the boolean to be true) || is or (only one of the expression must be true for the boolean to be set to true) Not (if true, boolean is set to false; if false, boolean is set to true)