Home Help Java A Java Abstract Class
Questions:Ask|Latest



Java Abstract Class
Posted on: May 27, 2009 By Deepak Kumar
An abstract class is a class that is declared by using the abstract keyword.

Java Abstract Class

     

An abstract class is a class that is declared by using the abstract keyword. It may or may not have abstract methods. Abstract classes cannot be instantiated, but they can be extended into sub-classes.

        --or--

Java provides a special type of class called an abstract class. Which helps us to organize our classes based on common methods. An abstract class lets you put the common method names in one abstract class without having to write the actual implementation code.

An abstract class can be extended into sub-classes, these sub-classes usually provide implementations for all of the abstract methods.

The key idea with an abstract class is useful when there is common functionality that's  like to implement in a superclass and some behavior is unique to specific classes. So you implement the superclass as an abstract class and define methods that have common subclasses. Then you implement each subclass by extending the abstract class and add the methods unique to the class.
 
Points of abstract class :

  1. Abstract class contains abstract methods.
  2. Program can't instantiate an abstract class.
  3. Abstract classes contain mixture of non-abstract and abstract methods.
  4. If any class contains abstract methods then it must implements all the abstract methods of the abstract class.

Recommend the tutorial

Ask Questions?    Discuss: Java Abstract Class   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
senna
June 2, 2011
Its more useful

Hi...Definition OK..its useful to me.but i need clear and easy example to understand.
S.TAMIL SELVAN`
June 14, 2011
java source code for abstract class

plz send java source code for abstract class with one good concept....
Vino
September 13, 2011
abstract class

Give me one eg using abstract class in java
Alam
September 19, 2011
Interface and packages in java

Hello sir actually i have to give presentation on interface and abstract class in java so i need ur help...please send me the practical definition of those two with an example......i wil be thankful to u..
priya
December 30, 2011
java codes need

Write a Java program that illustrates the implementation of abstract classes
mahes
February 3, 2012
help me

i need exact example for abstract....... and i have one doubt abstract class, abstract methods can be accessible in subclasses or not.
Ibrar Hussain
May 25, 2012
Java

I much like to learn java subject.
shalz
June 26, 2012
abstract class versus interface

just help me how can i differ abstract class & interface????for me both looks same:-(
SONU SINGH
July 24, 2012
java

please sir send me some java defination,methods,or any containts
Saqib Afridi
September 16, 2012
BS(IT)

I understand this very much because this is very simple so, every one can understand very much. I will try to get more and more knowledge from this site.
gagan
September 30, 2012
java

why we use abstract class in java?
Prasad
November 22, 2012
Abstract class and abstract method

Can you explain abstract class and method with example.....
fridoon
January 2, 2013
Abstract class

i am a website developer .. What is the use of abstract class and when its used?