aspose file tools*
The moose likes Java in General and the fly likes Interface and Abstract class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Interface and Abstract class" Watch "Interface and Abstract class" New topic
Author

Interface and Abstract class

Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
Can you explain me when to use the interface and when to use the Abstract Class?


Abhishek
bksella sella
Ranch Hand

Joined: Jul 31, 2003
Posts: 32
Hi Abhishek,

You will use an Interface when you want the developer to implement his own method implementations, but to have the same method signature.

You will use an Abstract class when you have some common implementation for certain methods and let the developer implement his own logic for the other methods which are declared abstract.

I hope you understood. Let me know if this is clear.


- Sella
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
This is a *very* frequently asked question. If you search this and the beginners forum, you should get tons of threads that discuss this topic.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interface and Abstract class