Notes(08-27-2008) - “short circuiting” True || or...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
8/27/2008 Should be in Chapters 1 and 2 in the book ++ and – before or after x doesn’t matter Returns old value before it prints the new one for System.out.println(++x + “ “ + x); =>It gives you the old value if you do it after, and the new value if you do it before Boolean contains 2 values: either true or false Boolean fred = false; Boolean b = fred; == versus != <= >= Can only compare characters, integers, and doubles ||: or – can’t be false false but can be true true false true or true false !: NOT – both are false
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: “short circuiting”: True || or False &&…Java stops evaluating from there…you can use this to prevent division by zero from crashing your program Careful with comparing doubles…decimals not represented accurately Only really hurts for equality tests Double on one or both sides for division = double result Can only compare doubles for “almost equality” Strings Finding length of the string \t = tab = one character Null = “not a string”, but is a value No empty char literals allowed...
View Full Document

This note was uploaded on 05/16/2011 for the course STATISTICS 225 taught by Professor Finegold during the Spring '11 term at Carnegie Mellon.

Ask a homework question - tutors are online