Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > implement or extend?

Reply
Thread Tools

implement or extend?

 
 
_.-=
Guest
Posts: n/a
 
      07-28-2003
Hi!

Whats the difference between "implements" and "extends"?

Thanks to all.

-ReAdY-


 
Reply With Quote
 
 
 
 
Manish Jethani
Guest
Posts: n/a
 
      07-29-2003
_.-=<[ { E v E r E a d y } ]>=-._ wrote:

> Whats the difference between "implements" and "extends"?


"implements" is for interfaces; "extends" is for classes.
Please look at the Java Tutorial on java.sun.com for an
explanation of classes and interfaces.

<http://java.sun.com/docs/books/tutorial/java/index.html>

--
Manish Jethani (manish.j at gmx.net)
phone (work) +91-80-51073488

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Daniel_Sj=F6blom?=
Guest
Posts: n/a
 
      07-29-2003
_.-=<[ { E v E r E a d y } ]>=-._ wrote:

> Hi!
>
> Whats the difference between "implements" and "extends"?
>
> Thanks to all.
>
> -ReAdY-
>
>


Well, you implement interfaces and you extend classes. You can only
extend one class in java, but you can implement many interfaces.
--
Daniel Sj÷blom

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      07-29-2003
On Tue, 29 Jul 2003 00:24:33 +0400, "_.-=<[ { E v E r E a d y }
]>=-._" <(E-Mail Removed)> wrote or quoted :

>Whats the difference between "implements" and "extends"?


see http://mindprod.com/jgloss/interfacevsabstract.html

You implement an interface and extend a class.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
_.-=
Guest
Posts: n/a
 
      07-30-2003
Since no one happened to answer my question, I thought I'd answer it myself
now that I've figured it out.

When you "extend" a class, any methods that you write with the same name
will override the parent class' method.

When you "implement" a class, the parent class had nothing more than the
method definition (i.e. there was no code in the method) so, in effect, all
you are doing is adding your own method code to what was just a method
declaration and therefore not overriding the parent methods.

Hope it helps anyone else who was looking for an answer to the same
question.

-EvErEady

"_.-=<[ { E v E r E a d y } ]>=-._" <(E-Mail Removed)> wrote in message
news:bg5b1f$(E-Mail Removed)...
> Hi!
>
> Whats the difference between "implements" and "extends"?
>
> Thanks to all.
>
> -ReAdY-
>
>



 
Reply With Quote
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      07-30-2003
Daniel Sj÷blom <(E-Mail Removed)_NOSPAM> writes:

> Well, you implement interfaces and you extend classes.


Except interfaces which may extend interfaces.
 
Reply With Quote
 
Joona I Palaste
Guest
Posts: n/a
 
      07-30-2003
"_.-=<[ { E v E r E a d y } ]>=-._" <(E-Mail Removed)> scribbled the following:
> Since no one happened to answer my question, I thought I'd answer it myself
> now that I've figured it out.


"No one happened to answer your question"? Then what do you call the
four answers you got from various people?

--
/-- Joona Palaste ((E-Mail Removed)) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"I will never display my bum in public again."
- Homer Simpson
 
Reply With Quote
 
Manish Jethani
Guest
Posts: n/a
 
      07-30-2003
Joona I Palaste wrote:

> "_.-=<[ { E v E r E a d y } ]>=-._" <(E-Mail Removed)> scribbled the following:
>
>>Since no one happened to answer my question, I thought I'd answer it myself
>>now that I've figured it out.

>
>
> "No one happened to answer your question"? Then what do you call the
> four answers you got from various people?


I think he meant that no one seemed to have given a satisfactory
answer. And after seeing his answer, I think I'll agree. He
gave a more complete answer to his own question.

But Java is now old enough that people will not answer basic
questions like the difference between "implements" and "extends".

Manish

--
Manish Jethani (manish.j at gmx.net)
phone (work) +91-80-51073488

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      07-31-2003
On Wed, 30 Jul 2003 13:36:03 +0400, "_.-=<[ { E v E r E a d y }
]>=-._" <(E-Mail Removed)> wrote or quoted :

>Since no one happened to answer my question, I thought I'd answer it myself
>now that I've figured it out.


I saw four answers posted before yours. Be careful not to insult the
hand that feeds you.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      08-01-2003
Manish Jethani <(E-Mail Removed)> writes:
> But Java is now old enough that people will not answer basic
> questions like the difference between "implements" and "extends".


No, we have a special group for such basic questions:

comp.lang.java.help

/Thomas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Column: Implement WPA2-Personal wireless security =?Utf-8?B?a2g=?= Wireless Networking 37 05-18-2006 09:04 PM
How to implement PEAP-EAP-TLD authentication? Edward W. Ray Wireless Networking 4 05-26-2005 10:14 PM
Is there a way to implement a true 5 r 3 w register file in altera's stratix fpga chip pandora VHDL 0 04-14-2004 03:16 AM
can we implement LIFO using SRL16 ??? Oleg VHDL 5 02-18-2004 10:29 PM
how to implement gated clock and gated partial circuit in VHDL? walala VHDL 3 09-23-2003 10:02 PM



Advertisments