What will be the output of the following code? class Vehicle { public void…

PYQ RPSC Programmer 2024

What will be the output of the following code? class Vehicle { public void move() { System.out.println("Vehicle is moving"); } } class Car extends Vehicle { public void move() { System.out.println("Car is moving"); } } public class Main { public static void main(String[] args) { Vehicle v = new Car(); v.move(); } }

  1. A.

    Runtime error

  2. B.

    Vehicle is moving

  3. C.

    Compilation error

  4. D.

    Car is moving

  5. E.

    Question not attempted

Attempted by 390 students.

Sign up free to check your answer

Sign up free

Explore the full course: Rpsc Programmer

Loading lesson…