Which is a valid abstract class?

Which is a valid abstract class?

Which is a valid abstract class?

A.
public abstract class Car { protected void accelerate(); }

B.
public interface Car { protected abstract void accelerate(); }

C.
public abstract class Car { protected final void accelerate(); }

D.
public abstract class Car { protected abstract void accelerate(); }

E.
public abstract class Car { protected abstract void accelerate() { //more car can do }}



Leave a Reply 3

Your email address will not be published. Required fields are marked *


imyrta

imyrta

Answer: D

Explanation:

A valid abstract class needs to have an abstract modifier defined before the class modifier and it needs at least one abstract method without a body.

God

God

an abstract class may or may not have an abstract method