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. | ||
Line 5: | Line 6: | ||
* Using objects as fields, arguments and local variables (Triangle project). | * Using objects as fields, arguments and local variables (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. | ||
* Boolean calculations. | * Boolean calculations. | ||
** Relational operators. | ** Relational operators. | ||
Line 11: | Line 16: | ||
** 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 30: | ||
{ | { | ||
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> |