*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes var-args question from skill test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "var-args question from skill test" Watch "var-args question from skill test" New topic
Author

var-args question from skill test

Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521


answer is 4...why? wont there be a compile error? how will the compiler decdie which to invoke? then what about this?


scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

jvm will choose printName(String firstName,String lastName) over var-args .


SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

check =>>http://www.coderanch.com/t/417622/Programmer-Certification-SCJP/certification/Golden-Rules-widening-boxing-varargs
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
whats that rule gotto do what this? here i think there is no case of widening or boxing
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
then what about this?

Becuase compiler will tread String[] and String... as String[] and you know that two methods with the same name can not have same type argument and hence the error.


SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
oh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: var-args question from skill test
 
Similar Threads
Why oh why do I even Try??
class name
Vararg Problem
Can you explain this with code...
public class or not