Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is output? public abstract class Vehicle { public abstract void move ( int miles ) ; public void printInfo ( ) { System.out.print (

What is output?
public abstract class Vehicle {
public abstract void move(int miles);
public void printInfo(){
System.out.print("Vehicle ");
}
}
public class Car extends Vehicle {
private int distance;
public void move(int miles){
distance = distance + miles;
}
public void printInfo(){
System.out.print("Car ");
}
public static void main(String args[]){
Vehicle myVehicle;
Car myCar;
myVehicle = new Vehicle();
myCar = new Car();
myVehicle.printInfo();
myCar.printInfo();
}
}
Question 22 options:
Vehicle
Vehicle Car
Error: Car is not abstract and does not override abstract method move()
Error: Vehicle is abstract and cannot be instantiated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Generative Artificial Intelligence For Project Management With Aws

Authors: Timothy Krimmel

1st Edition

B0CQV9KWB8, 979-8872627197

More Books

Students also viewed these Databases questions

Question

Employ effective vocal cues Employ effective visual cues

Answered: 1 week ago