Why can't we use abstract class in place of Interface?
Janusch - 16 Apr 2008 13:22 GMT
On 16 Apr., 14:00, ashutosh.singh.ku...@gmail.com wrote:
> Why can't we use abstract class in place of Interface?
Abstract class is a class.
Class has only ONE superclass.
Class can implement many interfaces.
Is this you problem?
Example:
class A extends B implements C,D,E,F,(...),Z{ }
A:class
B:superclass
C - Z: interfaces
Janush
http://kathorncity.no-ip.info/en/
Eric Sosman - 16 Apr 2008 13:26 GMT
> Why can't we use abstract class in place of Interface?
We can, under the right circumstances. Please be more
specific: What characteristics of abstract classes and
interfaces are you having trouble with?

Signature
Eric Sosman
esosman@ieee-dot-org.invalid
Chase Preuninger - 16 Apr 2008 14:02 GMT
Because you can only extends 1 class. You use a abstract class when
you fell that it would not make sense for an instance of that class to
be created, but you want to add more than what you can provide with an
interface.
Roedy Green - 24 Apr 2008 09:51 GMT
On Wed, 16 Apr 2008 05:00:18 -0700 (PDT),
ashutosh.singh.kumar@gmail.com wrote, quoted or indirectly quoted
someone who said :
>Why can't we use abstract class in place of Interface?
you can. For when to use each, see
http://mindprod.com/jgloss/interfacevsabstract.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com