How are the key words different both are used to incorporate inheritance..why is there a difference???
David McCombs
Ranch Hand
Joined: Oct 17, 2006
Posts: 212
posted
0
To put it simply extends is used to inherit other classes both abstract and non-abstract. implements is used in classes to inherit interfaces.
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
Remko Strating
Ranch Hand
Joined: Dec 28, 2006
Posts: 893
posted
0
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.
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 ]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.