









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Two boolean operators: && is the AND operations || is the OR operations
If statements for when x... ... is between 10 and 20 (inclusive) Cannot say: 10 <= x <= 20 (why?) ... is a vowel (x is type char)
When comparing doubles, you should use check to see if relative error is small: Math.abs((x-y)/x) < 10E- (double has about 16 digits of accuracy so you could go to 10E-15 if you want) For comparing Strings, use: string1.equals(string2);
Short-circuit evaluation is when you have a complex boolean expression (&& or ||) but you don't need to compute all parts. If this is true, then if will immediately run (See: ShortCircuit.java)
(Not that important, don't bother waking up) Every character has an associated integer (See: Lexicon.java) To get alphabetic ordering, you need to ignore case
Book gives a big precedence table of everything (even stuff we haven't learned yet) on page 126. Java uses this table (and any parenthesis you put in) to “fully parenthesize” lines. Example: x = 3+ becomes: (x = (3+2))
Example: x = 3+ becomes: (x = (3+2)) Java evaluation algorithm:
Write simple/clear expressions and you don't need to worry about this! If someone else wrote it and you have to fix it (Kitty code), slug through this process to find what is going on