This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Abstract & Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Abstract & Interface " Watch "Abstract & Interface " New topic
Author

Abstract & Interface

Siva kandasamy
Ranch Hand

Joined: Dec 31, 2002
Posts: 139
I am new this forum and new to Java.
In this forum, many explained the difference between the abstract and interfaces.
Does any one knows, what is the driver behind these two architecture which looks
pretty similar.
I mean, Why interfaces ?
What is that we can't achieve by having abstract class, we needed interface vice versa ?
Eric Fletcher
Ranch Hand

Joined: Oct 26, 2000
Posts: 188
Check out this article, it helped answer this question for me when I read it awhile back.
designing with interfaces
HTH,
E


My theory of evolution is that Darwin was adopted. - Steven Wright
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Interfaces provide the ability to have multiple inheritance.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Expanding a bit more: The C++ language allowed a more powerful form of multiple inheritance, and the Java language designers felt that this caused problems more often than it solved them. They felt that multiple inheritance of method declarations was a good thing, but multiple inheritance of method implementations was bad. So you can inherit as many declarations as you want, if they're defined in interfaces - but you can only directly inherit from one class. This inherited class may be an abstract class if there's at least some implementation which you wish to inherit, but if it doesn't make sense to provide a complete implementation (usually because you need the flexibility to implement some things differently in different classes, and there's no single "default behavior" for every method that makes sense to put in a base class).
Definitely check out the JavaWorld article Eric cited for more info.
[ December 31, 2002: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Siva kandasamy
Ranch Hand

Joined: Dec 31, 2002
Posts: 139
Thanks & Happy New Year.
-siva
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Abstract & Interface