wood burning stoves 2.0*
The moose likes Java in General and the fly likes var arg in method 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 » Java » Java in General
Bookmark "var arg in method" Watch "var arg in method" New topic
Author

var arg in method

saravanan ragunathan
Ranch Hand

Joined: Aug 02, 2010
Posts: 84


when i pass the primitive variables such as c or b with reference of int array
object(a) i am getting error ...why


"I Love Java Ranch"
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4344
    
    8

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

Joined: Aug 02, 2010
Posts: 84
why the java developers avoids this
is there any performance degradation..any other reason
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4344
    
    8

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

Joined: Aug 02, 2010
Posts: 84
thanks for sharing information ...

 
Don't get me started about those stupid light bulbs.
 
subject: var arg in method
 
Similar Threads
doubt in primitive assignment...
Var args question...
Public Variables
error in result
pls help exams are on my head