This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
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: 3019
    
  35

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
 
Similar Threads
5 Golden Rules of widening, boxing & varargs
WIDENING and VAR-ARG
Please Explain this Constructor parameter type ?
Why does this method call compile with only one argument ?
ExamLab: This snippet compiles, but the other one doesn't. Why?