09-26-2013 07:24 AM - edited 09-26-2013 07:30 AM
What is the best way to pass few values to the function ?
Just pass the as chars or char arrays etc something like this: function(char x, char z)
Create class(object) ..say ValuesToPass vltp; with variables , set and get methods.
Assign values: vltp.setX = blah, vltp.setZ = blahblah
... And pas vltp to the function like so: function(vltp) and the extract values using get methods..
Which way would be less time and heap space consuming?
From my point of view - passing values as values would be faster, but I'm new to java and can't be 100% sure about it..
Solved! Go to Solution.
09-26-2013 07:33 AM
If a method is going to working on three different bits of data, like 2 char arrays and an int, then I suspect most people would say just pass these in as parameters rather than creating a "temporary" Object just to contain these.