Q:

What is the output of the following java program (Override) ?

0

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();
        }
}

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

output:

Dogs can walk and run

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now