Forums Register Login

keywords implements and extends

+Pie Number of slices to send: Send
How are the key words different both are used to incorporate inheritance..why is there a difference???
+Pie Number of slices to send: Send
To put it simply extends is used to inherit other classes both abstract and non-abstract. implements is used in classes to inherit interfaces.
+Pie Number of slices to send: Send
 

implements is used in classes to inherit interfaces



You mean you will provide a legal implementation of the interface so that code outside your class can be sure that certain implementation of methods exist.
+Pie Number of slices to send: Send
 

Originally posted by Remko Strating:


You mean you will provide a legal implementation of the interface so that code outside your class can be sure that certain implementation of methods exist.



Yeah, I didn't like that when I wrote it, but couldn't think of a better answer at the time. Not all interfaces have methods defined, so perhaps a better explanation is when a class needs to use the implied contract of an interface.

And if an interface "inherits" another interface, extends is used.

[ August 08, 2007: Message edited by: David McCombs ]
[ August 08, 2007: Message edited by: David McCombs ]
Then YOU must do the pig's work! Read this tiny ad. READ IT!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 783 times.
Similar Threads
inheritance functionality with out extends
Java terminology doubt
Interface Extend vs Implement Another Interface
So null, true and false are not keyword
is Java Single inheritance or multiple inheritance
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 00:59:06.