wood burning stoves 2.0*
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
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
Author

Question 9 from Examlab practice exam 1

Henry Dai
Greenhorn

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: 3099
    
  40

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question 9 from Examlab practice exam 1