Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the following questions based on the following classes: public interface Washable { void wash(); } public abstract class Vehicle implements Washable { private String

Answer the following questions based on the following classes:

public interface Washable

{

void wash();

}

public abstract class Vehicle implements Washable

{

private String name;

public String getName()

{

return name;

}

}

public class Car extends Vehicle

{

@Override

public void wash()

{

// some super special code here

}

void boolean premiumGas()

{

// more code

}

)

What is the name of the interface?

Washable

Is the interface a functional interface? Why or why not?

Yes, any interface containing only one abstract method is known as a functional interface.

What is the name of the superclass?

Vehicle

What is the name of the subclass?

Car

Why did we have to put abstract on the Vehicle class?

Is Car also abstract? Why or why not?

Declare a variable of type Vehicle, but assign it an object of type Car

If you have the variable: Vehicle v, but you know it hold a Car reference, write a line that will print the value returned by calling premiumGas

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

DISCUSS competency-based pay.

Answered: 1 week ago

Question

What is the relationship between diversity, inclusion, and equity?

Answered: 1 week ago