aspose file tools*
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: 2885
    
  13

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
My Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question 9 from Examlab practice exam 1
 
Similar Threads
Please Explain this Constructor parameter type ?
WIDENING and VAR-ARG
Why does this method call compile with only one argument ?
ExamLab: This snippet compiles, but the other one doesn't. Why?
5 Golden Rules of widening, boxing & varargs