www.mormon.org
... and then cast the arrays back to that so they could be dog and cats again instead of just pets?
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
www.mormon.org
Originally posted by colton peterson:
sorry that was a typo. I ment cast the pets back.
www.mormon.org
Originally posted by colton peterson:
Thanks. Now what if one day I expanded the program and add like 20 other types of pets would I have to make a big long else/if stament or is there another way or collection I could use? Also to make the instanceOf work don't I need to override something from object?
Also to make the instanceOf work don't I need to override something from object?
www.mormon.org
www.mormon.org
Originally posted by colton peterson:
Okay, so if I made a superclass animal and had all the code I might need in it I could just cast them back to animal? If so what if I needed to put dog specific code in the dog class that extended animal?
www.mormon.org
www.mormon.org
Don't get me started about those stupid light bulbs. |