Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners What is an abstract method?

Have Programming Question? Ask it here!
 
 
 


Java Coder
What is an abstract method?
1 Answer(s)      a year ago
Posted in : Java Beginners


Hi,

What is an abstract method?

thanks


Advertisement
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
 

 

 

DMCA.com