aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Confusion with the below mentioned code 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 "Confusion with the below mentioned code" Watch "Confusion with the below mentioned code" New topic
Author

Confusion with the below mentioned code

binnu yadav
Greenhorn

Joined: Jan 10, 2010
Posts: 12




If I compile this code,get this error message:-
cannot declare both method(java.lang.String,java.lang.String...) and method(java.lang.String,java.lang.String[]) in Overload
final Object method(String name, String... names) {
^
1 error.

Can somebody explain me the concept behind this ?

and If I am trying this code :-


It works fine........

Please make me understand the logic !!!

Regards,

Arun

vicky ma
Ranch Hand

Joined: May 13, 2009
Posts: 38
http://www.coderanch.com/t/455788/Programmer-Certification-SCJP/certification/overriding-meth-String-wih-meth

above thread will solve your all doubt

Neha Daga
Ranch Hand

Joined: Oct 30, 2009
Posts: 504
because var args works as arrays and both of your methods in the first code seems to have same arguments to the compiler and hence violates the rule of overloadinng that argument list should be different, so it gives compiler error.


SCJP 1.6 96%
binnu yadav
Greenhorn

Joined: Jan 10, 2010
Posts: 12
Thanks a lot........got the point.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusion with the below mentioned code