Welcome to Questionaries, where you can ask questions and receive answers from other members of the community.

Let us know at info@questionaries.org

What does it mean that a method or class is abstract in java?

5 like 0 dislike
Hello
What does it mean that a method or class is abstract in java?
please reply me. i am waiting for your reply.
Thanx
asked 1 year ago by eagles11 (179,830 points)

1 Answer

1 like 0 dislike
 
Best answer
An abstract class cannot be instantiated. Only its subclasses can be instantiated. You indicate that a class is abstract with the abstract keyword like this:
public abstract class Container extends Component {
Abstract classes may contain abstract methods. A method declared abstract is not actually implemented in the current class. It exists only to be overridden in subclasses. It has no body. For example,
public abstract float price();
Abstract methods may only be included in abstract classes. However, an abstract class is not required to have any abstract methods, though most of them do.
Each subclass of an abstract class must override the abstract methods of its superclasses or itself be declared abstract.
answered 1 year ago by DBA-boss (120,990 points)

Related questions

2 like 0 dislike
1 answer
6 like 0 dislike
1 answer
5 like 0 dislike
1 answer
2 like 0 dislike
1 answer
5 like 0 dislike
1 answer
asked 1 year ago by DBA-boss (120,990 points)