File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abstarct class & Interfaces

 
Krazee soul
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the differences between a pure abstract class & interface apart from the fact that interfaces allow multiple inheritance?
 
Mike Gershman
Ranch Hand
Posts: 1272
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"pure abstract class" is not a Java term, but I guess it means a class that does nothing an interface can't do. (No concrete methodes or nonfinal fields). Is that what you mean?
 
Krazee soul
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that is what I mean
 
David Harkness
Ranch Hand
Posts: 1646
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that's the only difference, unless you count the fact that the abstract class and its methods would have to be declared abstract while the interface's methods are implicitly abstract.

Given that, why not use an interface?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Krazee soul:
What are the differences between a pure abstract class & interface apart from the fact that interfaces allow multiple inheritance?


None. It's the only reason for the existence of interfaces in Java: to allow at least some form of multiple inheritance.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic