Review Rivendell
From Huben's Wiki
(Created page with "* Constructors ** No-arguments constructors. ** Constructors with arguments. ** Overloading constructors. * Using objects as fields, arguments and local variables (Triangle proje...") |
|||
Line 1: | Line 1: | ||
* Constructors | * Constructors | ||
+ | ** Set the fields. | ||
** No-arguments constructors. | ** No-arguments constructors. | ||
** Constructors with arguments. | ** Constructors with arguments. | ||
** Overloading constructors. | ** Overloading constructors. | ||
− | * Using objects as fields, arguments and local variables (Triangle project | + | ** The meaning of final. |
+ | * Using objects as fields, arguments and local variables ([[Solution to Triangle project]].) | ||
** Understanding difference between static (class) and non-static (instance) fields. | ** Understanding difference between static (class) and non-static (instance) fields. | ||
+ | ** Using static methods when you don't have an object. | ||
+ | ** Static methods do not have instance fields. | ||
+ | ** Creating objects within static methods. | ||
+ | ** Using object instances with their instance fields. | ||
+ | ** Creating arrays of objects. | ||
+ | *** Declare the array. | ||
+ | *** Allocate the array of object VARIABLES with new. | ||
+ | *** Use new to create objects for each of the variables in the array. | ||
* Boolean calculations. | * Boolean calculations. | ||
** Relational operators. | ** Relational operators. | ||
*** Why == instead of =. | *** Why == instead of =. | ||
+ | *** Beware comparing doubles with ==. | ||
*** The other 5 relational operators. | *** The other 5 relational operators. | ||
+ | *** String methods charAt() and length(). | ||
** Boolean operators. | ** Boolean operators. | ||
*** &&, ||, !, ^ | *** &&, ||, !, ^ | ||
+ | *** Make truth tables of them. | ||
* Simple use of if and else. | * Simple use of if and else. | ||
<pre> | <pre> | ||
Line 24: | Line 37: | ||
{ | { | ||
if (age < 21) | if (age < 21) | ||
− | System.out.println(" | + | System.out.println("Here's a Coke, kid!"); |
else | else | ||
− | System.out.println(" | + | System.out.println("Wanna beer?"); |
} | } | ||
</pre> | </pre> |