What is an abstract method?

Hi,

What is an abstract method?

thanks

View Answers

April 16, 2013 at 1:46 PM

Hi friend,

Abstract methods are the methods declared using the keyword 'abstract'. An abstract method must not be defined in its declaring class and it should be closed by following the semicolon at the end of line. An abstract method is defined by its implementing class or subclass. A class which declares the abstract method then this class must be declared as abstract.

An abstract method should be declared as follows :

abstract void show();
abstract void display(String name);

A class that includes the abstract method must be declared as follows :

public abstract class Show {
   // declare fields
   // declare non-abstract methods
   abstract void show();
   abstract void display(String name);
}









Related Tutorials/Questions & Answers:
Advertisements