Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Animal = Alliance
- Dog = House
- Cat = Army
- When you convert to alliance, how do you know whether you need battle strength of house and army
- Abstract class - gets the common methods between the two classes.
- Common stuff - getName, getYears, getBanner
- Cat and Dog both have sound() but have different implementation (dog has woof, cat has meow)
- Animal ani = new Cat()
- ani.sound() //
- Interfaces only have abstract methods // public abstract String sound();
- Wrong: newArr[ii] = new Cat (arr[ii]);
- Correct: arr[ii].clone(); Since we don't know the datatype
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement