File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Abstract Clas vs Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Abstract Clas vs Interface" Watch "Abstract Clas vs Interface" New topic

Abstract Clas vs Interface

sahidul karim

Joined: Sep 19, 2006
Posts: 28
Give me some practical scenario where should i use interface and where i ll go for abstarct class.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Not a servlet specific question.

When does it make sense to choose an abstract class over an interface
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
wrong forum mate...
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
In layered programming go for interfaces.So that one team can make the layer with the interface without bothering about the implementation of that interface.
Abstract class is used to represent something in OO concept where someof the common implementation are common and some are case specific.So you can define the common functionalities as concrete and leave remaining as abstract to be implemented by the class which would extend this class.

Rahul Bhattacharjee
LinkedIn - Blog
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
this is asked at least once a week, why don't you search the archives (or better yet, get a decent book on software design principles)?

karthikeyan Chockalingam
Ranch Hand

Joined: Sep 06, 2003
Posts: 259

I agree. Here's the link:
subject: Abstract Clas vs Interface
It's not a secret anymore!