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();
}
}
a.
Vehicle
b.
Vehicle Car
c.
Error: Car is not abstract and does not override abstract method move()
d.
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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

7. What decisions would you make as the city manager?

Answered: 1 week ago

Question

8. How would you explain your decisions to the city council?

Answered: 1 week ago