Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Question 9 from Examlab practice exam 1  RSS feed

 
Henry Dai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Marshal
Posts: 5323
575
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!