// DrJava saved history v2 Tutorial 2 Jan 5, 18:00 44 // int double - types of values // boolean false ! fals ! false !true // ! is the NOT (negation) operator AND: (&&) // AND: (&&) true && true false && false // OR: (||) fale || true false || true 5 == 6 // == means "are they equal?" 5 != 6 5 > 6 5 < 6 // Why bother with booleans? One reason: Results of comparions (equal/greater // than, etc.) are always a boolean value and we very often need to // know how things compare (are the tips greater than the minimum wage?) (4>3) && (4>=5) (4>3) && (4<=5) true + false // Error messages are in red // Java is very, very careful about types 40 + false 4 && 332 // another type: char 'b' 5.99 (int) 5.99 // int type is narrower than double - every int is (can be // represented as) a double, but not vice versa (double) 5 (int) 'b' (int) 'B' (int) '$' (int) ' ' 'b' + 'B' b = 'b' + 'B'; b // double, int, boolean, char mikey = 99; mikey = 99 mikey 'mikey' "mikey" // String is indicated by double quotes around a sequence of characters mikey= mikey + 99; mikey foo= false !foo mikey - 2 !mikey !196 // now for something completely different import javax.swing.*; j= new JFrame(); j.show(); j.hide(); // j.show() -- a method call on j j.show(); j.setTitle(" I am a new window");