| Author |
Abstract method or Interface method ??
|
dilan alex
Greenhorn
Joined: Sep 17, 2011
Posts: 27
|
|
Hi all,
I'm cannot understand this situation in abstract methods and interface method.
let say, there is a interface 'Test' and abstract class Info
Following class extends Info and implements Test.
Can anyone explain me which load() method is implemented ??
As code compiled and run, it seems that interface load method is implemented. but how??
What happen to the abstract class method ??
Regards,
Dil.
|
 |
Ganesan Ponnusamy
EPractice Labs Support
Ranch Hand
Joined: Nov 07, 2005
Posts: 249
|
|
Dilan alex,
As your method signature (name, parameters and return values) are same in interface and abstract class, the implementation in concrete class is common.
How can you say interface load() method is implemented?
The implementation is common to both Test and Info.
|
Ganesan Ponnusamy Java Certification | Test Generator | OCAJP | OCPJP | OCEJWSD | EJB Certification
OCEJPAD | SCJD | SCWCD | SCBCD | SCDJWS | OCMJEA | Web Services Certification | SCMAD
|
 |
naveen yadav
Ranch Hand
Joined: Oct 23, 2011
Posts: 380
|
|
that doesn't seems to be problem .
you are providing the implementation of a method from abstract class in a subclass .
you are providing the implementation of a method from interface as well
the coincidence is the signature of both method is same so what it shouldn't be the matter of compiling to the JVM.
naveen
|
 |
 |
|
|
subject: Abstract method or Interface method ??
|
|
|