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)

Define a Super class named Point containing: A pro... >>
<< What is the output of the following java program (...