This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Abstract method or Interface method ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Abstract method or Interface method ??" Watch "Abstract method or Interface method ??" New topic
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
 
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.
 
subject: Abstract method or Interface method ??
 
Similar Threads
weird certification question.
Sierra/Bates Book Chapter 1 Question
JLS 6.4.3 The Members of an Interface Type
interface and abstract methods with the same name
Basic Question about extending/implementing