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(); } }
- A.
Runtime error
- B.
Vehicle is moving
- C.
Compilation error
- D.
Car is moving
- E.
Question not attempted
Attempted by 390 students.
Sign up free to check your answer
Sign up freeLoading lesson…

