Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

var arg in method

 
saravanan ragunathan
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


when i pass the primitive variables such as c or b with reference of int array
object(a) i am getting error ...why
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The var-arg method will take either an int array, or any number of int parameters. But you can't mix them.
 
saravanan ragunathan
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why the java developers avoids this
is there any performance degradation..any other reason
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's just how the language is designed. And there are pretty good reasons for the design - you'd run into problems with overloaded methods where it was ambiguous which version was called. But fundamentally, this is one of those questions where the answer is "because that's how it works".

 
saravanan ragunathan
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for sharing information ...

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic