Outline for Chapter 6 Review
From Huben's Wiki
(Created page with "* Constants ** Literal vs. Symbolic. ** \ escape in String and char. * Why use symbolic constants? * Variables ** Fields vs. local variables. * Primitive vs. Object vs. String. *...") |
|||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
* Variables | * Variables | ||
** Fields vs. local variables. | ** Fields vs. local variables. | ||
− | * Primitive vs. Object vs. String. | + | ** Primitive vs. Object vs. String. |
+ | *** Operators vs. Methods. | ||
*** Primitives and String have their own literal constants. | *** Primitives and String have their own literal constants. | ||
*** String is a special Object: knows +. | *** String is a special Object: knows +. | ||
** Scope | ** Scope | ||
*** Syntax error if local variables overlap. | *** Syntax error if local variables overlap. | ||
− | *** If local variables and fields overlap, field concealed. | + | *** If local variables and fields overlap, field concealed. !!! |
− | ** Range (and overflow problems.) | + | ** Range (and overflow problems.) !!! |
− | * | + | * Constants |
+ | ** Literal vs. Symbolic. | ||
+ | *** Symbolic have names and scope, fields or local. | ||
+ | ** 5 basic types of literal constants. | ||
+ | *** \ escape in String and char. | ||
+ | ** Why use symbolic constants? | ||
+ | * Operators | ||
+ | ** Unary vs. Binary | ||
** Order of operations. (Table in book pg. 163) | ** Order of operations. (Table in book pg. 163) | ||
− | ** Division, int or double. (Possible logic errors.) | + | ** Division, int or double. (Possible logic errors.) !!! |
** Boolean operators. | ** Boolean operators. | ||
** Comparison operators. | ** Comparison operators. | ||
− | *** Do not confuse == with = | + | *** Do not confuse == with = !!! |
** Casting (coercion). | ** Casting (coercion). | ||
*** + with String | *** + with String | ||
*** toString() | *** toString() | ||
*** Doubles to integers: (int), Math.floor(), Math.ceil(), Math.round() | *** Doubles to integers: (int), Math.floor(), Math.ceil(), Math.round() | ||
− | **** Simple assignment gives an error. | + | **** Simple assignment gives an error. !!! |
** Tricks for integers with / and %. | ** Tricks for integers with / and %. | ||
* Assignment operators. | * Assignment operators. | ||
** Lowest precedence. | ** Lowest precedence. | ||
** Style: usually only one per line. | ** Style: usually only one per line. | ||
+ | * 5 gotcha problems listed above with !!! |