(But not vice versa.)
void openFridge(Object object) {
____if(!(object instanceof Fridge)) {
________throw new IllegalArgumentException("!(object instanceof Fridge)");
____} else {
________((Fridge) object).open();
____}
}
void openFridge(Fridge fridge) {
____if(fridge == null) {
________throw new IllegalArgumentException("fridge == null");
____} else {
________fridge.open();
____}
}
torstai 18. joulukuuta 2008
Tilaa:
Blogitekstit (Atom)
Blogiarkisto
-
►
2009
(4)
- ► huhtikuuta (1)
- ► helmikuuta (1)
-
▼
2008
(6)
- ► toukokuuta (2)
- ► huhtikuuta (1)
- ► maaliskuuta (1)