File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Extend & Implement ? 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Extend & Implement ?" Watch "Extend & Implement ?" New topic
Author

Extend & Implement ?

Gajanan Bandale
Greenhorn

Joined: May 09, 2005
Posts: 22
What is diff between extend and Implement keyword?
When one use extend or implement?
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
extend - use for inheritance
implements - use when your class is implementing interface.


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

extend - use for inheritance

<nitpick>implementing an interface is inheritance as well...</nitpick>

Extends is used to inherit from an abstract or concrete class. Implements is used to inherit an interface. Hope this helps...

Object-Oriented Programming Concepts
Joshua Smith
Ranch Hand

Joined: Aug 22, 2005
Posts: 193
Also, in Java a class can only extend one class, but a class may implement as many interfaces as it likes.


Rational Pi Blog - Java, SCJP, Dev Bits- http://rationalpi.wordpress.com
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
And also interface can extend only one interface
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

No, an interface can extend multiple interfaces.

Example:

[ August 25, 2005: Message edited by: Steve Morrow ]
Kalyana Sundaram
Ranch Hand

Joined: Mar 18, 2005
Posts: 94
Thanks a lot Steve.
This is really an useful tip :-)


Only those who will risk going too far can possibly find out how far one can go !!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Extend & Implement ?
 
Similar Threads
interface
Inner classes must extend?
code that runs automatically to update sql tables on a specified date and time
about EVAL_BODY_BUFFERED problem?
interface extends interface ?