Java Programming Question about superclass
Posted on 2011-10-05
If we have a superclass called Animal which has a method called move(), and 2 subclasses Bird and Fish that extend from Animal. Bird has its own version of move() method which will have the movement of "fly". Fish has its version of move() method which execute "swim". If you create 2 objects:
Animal a1 = new Bird();
Animal a2 = new Fish();
What will happen when you call move() method using a1 with a1.move()? How about a2.move()?