What is the output of the following program (Override)?
class Animal {
public void move() {
System.out.println("Animals can move");
}
}
class Dog extends Animal {
public void move() {
System.out.println("Dogs can walk and run");
}
}
public class TestDog {
public static void main(String args[]) {
Dog d = new Dog();
d.move();
}
}
output:
Dogs can walk and run
need an explanation for this answer? contact us directly to get an explanation for this answer