File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question 9 from Examlab practice exam 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question 9 from Examlab practice exam 1" Watch "Question 9 from Examlab practice exam 1" New topic

Question 9 from Examlab practice exam 1

Henry Dai

Joined: Feb 27, 2009
Posts: 10

Hi, all , i have a question on var-arg. why line#1 invoke method 2 instead of method 5. Isn't that var-arg will be last considered? int[] is also an object, why it didnt choose method 5 over method 2. Could someone please explain, thank you!
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3383

var-arg parameters can accept arrays too. For an array argument, a var-arg parameter is more appropriate, other than passing it to a parameter with java.lang.Object type.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
jQuery in Action, 2nd edition
subject: Question 9 from Examlab practice exam 1