Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2300 > unrolled thread

Difference between "extends" and "implements" ?

Started byitsfaixan@gmail.com
First post2012-11-30 12:52 -0800
Last post2012-12-01 16:26 -0800
Articles 7 — 6 participants

Back to article view | Back to comp.lang.java.help


Contents

  Difference between "extends" and "implements" ? itsfaixan@gmail.com - 2012-11-30 12:52 -0800
    Re: Difference between "extends" and "implements" ? Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-11-30 16:31 -0500
      Re: Difference between "extends" and "implements" ? markspace <-@.> - 2012-11-30 13:33 -0800
        Re: Difference between "extends" and "implements" ? Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-01 09:26 -0500
    Re: Difference between "extends" and "implements" ? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-11-30 15:57 -0600
    Re: Difference between "extends" and "implements" ? Roedy Green <see_website@mindprod.com.invalid> - 2012-11-30 18:00 -0800
    Re: Difference between "extends" and "implements" ? Lew <lewbloch@gmail.com> - 2012-12-01 16:26 -0800

#2300 — Difference between "extends" and "implements" ?

Fromitsfaixan@gmail.com
Date2012-11-30 12:52 -0800
SubjectDifference between "extends" and "implements" ?
Message-ID<275f7463-7919-4ce3-b555-fbbcdcbaf5ce@googlegroups.com>
What is the difference between "extends" and "implements" ?

[toc] | [next] | [standalone]


#2301

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2012-11-30 16:31 -0500
Message-ID<k9b8k1$491$1@dont-email.me>
In reply to#2300
On 11/30/2012 3:52 PM, itsfaixan@gmail.com wrote:
> What is the difference between "extends" and "implements" ?

     A class "extends" exactly one other class, its direct
superclass.[*]  In `class Sub extends Super {...}', each Sub
instance *is a* Super as well.  Also, Sub inherits as much
of Super's implementation as Super allows it to access, so
if the Super class implements a `void eatTwinkies()' method,
Sub gets that same implementation without any effort.  (Sub
may choose to supply its own implementation of eatTwinkies(),
but doesn't have to: If it does, that's "overriding.")

     [*] Special case: The class java.lang.Object has no
superclass, and all inheritance chains eventually lead upward
to Object.  Thus, every object *is an* Object instance.

     A class "implements" any number of interfaces.  An interface
specifies a group of methods, but does not implement them at
all.  The implementing class promises to provide implementations
that match the interface specifications.  So if you have
`class Sub extends Super implements Mortal {...}' and the
Mortal interface calls for a `void die()' method, Sub must
implement of `void die()'.

     There's a little more to it than that, but not a whole lot
more: There are "abstract" classes, and there are interfaces
that serve only to define constants (a practice now widely
frowned upon, but still found in older API's).  Don't worry
about these until you get to a later lesson: For now, work on
understanding the difference between "class" and "interface".

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

[toc] | [prev] | [next] | [standalone]


#2302

Frommarkspace <-@.>
Date2012-11-30 13:33 -0800
Message-ID<k9b8nj$4i2$1@dont-email.me>
In reply to#2301
On 11/30/2012 1:31 PM, Eric Sosman wrote:
> On 11/30/2012 3:52 PM, itsfaixan@gmail.com wrote:
>> What is the difference between "extends" and "implements" ?
>
>      A class "extends" exactly one other class, its direct


*cough* Homework question

[toc] | [prev] | [next] | [standalone]


#2307

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2012-12-01 09:26 -0500
Message-ID<k9d42t$9c4$1@dont-email.me>
In reply to#2302
On 11/30/2012 4:33 PM, markspace wrote:
> On 11/30/2012 1:31 PM, Eric Sosman wrote:
>> On 11/30/2012 3:52 PM, itsfaixan@gmail.com wrote:
>>> What is the difference between "extends" and "implements" ?
>>
>>      A class "extends" exactly one other class, its direct
>
>
> *cough* Homework question

     Do you really think so?  As a gauge of student proficiency it
seems a pretty ineffectual question.  I think a teacher would pose
a problem requiring the student to demonstrate understanding, not
just parrot a few keywords.

     Even if it was homework, though, I don't think any harm's
been done.  If the student just submits my response as it stands
it'll be obvious that the words and work weren't his.  And if he
takes the time to read my text, understand it, and paraphrase it --
well, then he'll have learned the difference between "extends" and
"implements" and will be showing his knowledge, and wasn't that
the goal anyhow?

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

[toc] | [prev] | [next] | [standalone]


#2303

FromJoshua Cranmer <Pidgeot18@verizon.invalid>
Date2012-11-30 15:57 -0600
Message-ID<k9ba5h$dol$1@dont-email.me>
In reply to#2300
On 11/30/2012 2:52 PM, itsfaixan@gmail.com wrote:
> What is the difference between "extends" and "implements" ?

Assuming base 36, -1,892,116,818,960,192.


-- 
Beware of bugs in the above code; I have only proved it correct, not 
tried it. -- Donald E. Knuth

[toc] | [prev] | [next] | [standalone]


#2304

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-11-30 18:00 -0800
Message-ID<s3pib8lirplirfr2rr7pbjs1bgrtkha2mf@4ax.com>
In reply to#2300
On Fri, 30 Nov 2012 12:52:48 -0800 (PST), itsfaixan@gmail.com wrote,
quoted or indirectly quoted someone who said :

>What is the difference between "extends" and "implements" ?
 see 
http://mindprod.com/jgloss/extends.html
http://mindprod.com/jgloss/implements.html
http://mindprod.com/jgloss/interfacevsabstract.html
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Students who hire or con others to do their homework are as foolish 
as couch potatoes who hire others to go to the gym for them. 

[toc] | [prev] | [next] | [standalone]


#2308

FromLew <lewbloch@gmail.com>
Date2012-12-01 16:26 -0800
Message-ID<063dd793-dc8b-42a4-a3f8-b506c308fb94@googlegroups.com>
In reply to#2300
On Friday, November 30, 2012 12:52:48 PM UTC-8, itsf...@gmail.com wrote:
> What is the difference between "extends" and "implements" ?

RTFM
http://docs.oracle.com/javase/tutorial/java/IandI/index.html

GIYF
http://lmgtfy.com/?q=What+is+the+difference+between+extends+and+implements+in+Java

-- 
Lew

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.help


csiph-web