Avatar of bakerule22

asked on 

Java Programming Question about superclass

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()?

Avatar of undefined
Last Comment

8/22/2022 - Mon