File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Abstarct class & Interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Abstarct class & Interfaces" Watch "Abstarct class & Interfaces" New topic
Author

Abstarct class & Interfaces

Krazee soul
Greenhorn

Joined: Feb 13, 2005
Posts: 5
What are the differences between a pure abstract class & interface apart from the fact that interfaces allow multiple inheritance?
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
"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?


Mike Gershman
SCJP 1.4, SCWCD in process
Krazee soul
Greenhorn

Joined: Feb 13, 2005
Posts: 5
Yes that is what I mean
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
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

Joined: Jul 11, 2001
Posts: 14112
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.


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: Abstarct class & Interfaces
 
Similar Threads
true or false
Interface
what we should do with interface when create jar file ?
java.lang.Object is a class or Interface
Interface question from Khalid and Rasmussen