wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Implementing an interface by changing the argument name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Implementing an interface by changing the argument name" Watch "Implementing an interface by changing the argument name" New topic
Author

Implementing an interface by changing the argument name

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

In the following example



The code implements the interface but the argument in the bounce method is different in that it is using a different name i.e.



The code compiles and runs fine. I thought that the above is considered to be overloading i.e. the argument list has changed.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4392
    
    8

What identifies a method is the name of the method and the types of the argument list. The names of the arguments don't matter.

If that was considered overloading, and I made the call bounce("Bounce this"), which method would you expect to be called? There'd be no way of telling.
Christian Joseph
Ranch Hand

Joined: Jan 07, 2011
Posts: 43
Identifiers (name)doesn't matter.. Yap thats will run smooth
O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

Matthew Brown wrote:If that was considered overloading, and I made the call bounce("Bounce this"), which method would you expect to be called? There'd be no way of telling.


Ok i see what you mean.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Implementing an interface by changing the argument name