Array
Ok I'm stumped and just can't think of it. How do you set up a java class where you can pass it an array it does something with it and returns a new one?
Ok I'm stumped and just can't think of it. How do you set up a java class where you can pass it an array it does something with it and returns a new one?
> Ok I'm stumped and just can't think of it. How do
> you set up a java class where you can pass it an
> array it does something with it and returns a new one?
public int[] doSomethingWith(int[] array) {
int[] newArray = array.clone();
// do that voodoo with newArray...
return newArray ;
}
[EDIT] I missed the part about return a *new* array. Good Lord; my return type was messed up, too. More coffee...
~
public String[] someMethod(String[] someArray) {
String[] s = new String[10];
. . . populate . . .
return s;
}
>
> [EDIT] I missed the part about return a *new* array.
> Good Lord; my return type was messed up, too. More
> coffee...
>
> ~
...and the Good Lord said, "Let there be Java!"
> lol thanks ya I'm on my fourth cup...still isn't
> helping
Don't give up! I read in Sience et Vie that drinking coffee makes us smarter! I'm on my third one and still counting
;)
Manuel Leiria