Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is an abstract method?

abstract method
0
Posted

What is an abstract method?

0

Ans : An abstract method is a method that defines all aspects of itself except what code it executes. An abstract method declares the method’s name, parameter types, return type, and exceptions, but does not provide an implementation for the method. You declare an abstract method with the abstract keyword and with a semicolon in place of the method body. For example: public abstract void drawFigure(); // abstract method declaration Abstract methods let you design a class with some or all pieces left for subclasses to fill in. A class containing abstract methods is also called abstract, and must also be declared with the abstract keyword. By including an abstract method in a class, you require that anyone who implements a fully functional (concrete) subclass will have to include an implementation for that method. For example, the Number class in the java.lang package consists entirely of abstract methods. The full JDK (1.0.2 and 1.1) class definition is: /* in Number.java (JDK 1.0.2 and

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.