What will be the result of compiling and executing the following program code?
class Vehicle{
      public void printSound(){
            System.out.print("vehicle");
      }
}
class Car extends Vehicle{
      public void printSound(){
            System.out.print("car");
      }
}
class Bike extends Vehicle{
      public void printSound(){
            System.out.print("bike");
      }
}
public class Test{
      public static void main(String[] args){
            Vehicle v = new Car();
            Bike b = (Bike) v;
        
            v.printSound();
            b.printSound();
      }
}

Views 👁 2,134


Answer


Warning: Undefined array key "answer" in /home/u981206607/domains/rummanansari.com/public_html/app/views/questions/explanatory.php on line 21