Doubt about returning array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I've a method that return a array, and my doubt is how i'll create a array
variable that will receive the return if I don't know the size of return.

There are another way to do this without use ArrayList ?

Thanks,

Solli M. Honorio
 
...
I've a method that return a array, and my doubt is how i'll
create a array variable that will receive the return if I
don't know the size of return.

The array variable in itself doesn't know anything about the size of the
array anyway, as it only holds a reference to the array object.

So you just need to declare the variable as an array, without size, just as
you would when you create an array yourself, e.g.:

double[] doubleArray = MethodThatReturnsAnArrayOfDoubles();

// Bjorn A
 
Back
Top