This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
hi please go through and find a solution for this atleast in a different way.
You are given a class hierarchy with an instance of the class Dog. The class Dog is a child of mammal and the class Mammal is a child of the class Vertebrate. The class Vertebrate has a method called move which prints out the string "move". The class mammal overrides this method and prints out the string "walks". The class Dog overrides this method and prints out the string "walks on paws". Given an instance of the class Dog,. how can you access the ancestor method move in Vertebrate so it prints out the string "move";
I thought this way. Check the code. I just made method static and assigned Vertebrate ref an instance of Dog. class Vertibrate { public static void move() { System.out.println("Move"); }
}
class Mammal extends Vertibrate { public static void move() { //super.move(); System.out.println("Walks"); } }
class Dog extends Mammal { public static void move() { //super.move(); System.out.println("Walks on paws"); } }
public class Mobile { public static void main(String[] args)