The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Re:

Posted by A.P on October 18, 2001 at 11:53 PM


Abstract classes have important distinction from interfaces.

interfaces cannot have method body. If base abstract class defines a method, a child does not have to redefine it unless it wants to.

> 1 ans) If you examine carefully abstract classes provide
> the defintion or skelton part for members so that any one can
> implement and custonmize the methods as per the requirements.

> cheers
> venu

> > I wish to ask you certain doubts . While reading the subject , I got the feeling that most of the books are written with the 'how' and not 'why' approach . And certain design aspects are left unanswered .
> > Like :
> > 1) why was there a need for 'abstract classes' when ( seemingly) all the functionality could be achieved by the use of interface / concrete classes ?
> > 2) why didn't Sun provide for multiple inheritance for classes and did it for interfaces - as far as I could reckon , there is virtually no difference between the two ( an interface is as good as an abstract class ) ? ( I am not particularly convinced with the argument that it makes the compilers complex - after all it does exit already in C++ compiler .)
> > 3) how do togging interfaces viz. 'cloneable', ' serializable' etc. work ; which do not have any methods declared ( or defined ) inside them. Also, are these not the examples of multiple inheritance in some way ?

> > There must be more design aspects which I have not been able to come up to. I request you to please tell me where I can the answer to these questions as well as a more in depth dealing about why Java is the way it is . Please suggest me the readable books on the topic .





Replies:
  • Java Design Matt Gerrans October 19, 2001 at 2:05 PM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us