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



Home Java Master-java Abstract methods and classes

Related Tutorials


 
 

Share on Google+Share on Google+

Abstract methods and classes

Advertisement
While going through the java language programming you have learned so many times the word abstract. In java programming language the word abstract is used with methods and classes.

Abstract methods and classes

     

While going through the java language programming you have learned so many times the word abstract. In java programming language the word abstract is used with methods and classes. 

Abstract Method

An abstract method one that have the empty implementation. All the methods in any interface are abstract by default. Abstract method provides the standardization for the " name and signature" of any method. One can extend and implement to these methods in their own classes according to the requirements. 

  e.g.

public abstract abs_value();

Abstract Class

In java programming language, abstract classes are those that works only as the parent class or the base class. Subclasses are derived to implement the methods inherited from the abstract class (base class). Abstract classes are not instantiated directly. First extend the base class and then instantiate (create objects). Abstract classes are generic in nature and implement to those methods that are used commonly by the subclasses with common implementation. Abstract classes .

e.g.

abstract class A{
 public abstract abs_value();
 
 void show(){
 System.out.println("This is an abstract class");
 }
 }
Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 11, 2007

Related Tutorials

Discuss: Abstract methods and classes   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:3
sunil kumar
April 25, 2011
abstract class

what is the use of abstract class and abstract methosds.
Thokozani Madondo
May 21, 2012
Thanks

Thanks for the good answers regarding Abstract method and classes that were given to me I found them very usefull, I will keep on using this site.
soniya gupta
September 29, 2013
abstract class

can we declared static member in abstract class and able to accessed non static member funvtion ?
DMCA.com