Page 1 of 1

Java - Arrays and Methods

Posted: Tue Mar 02, 2004 6:05 pm
by d3ad1ysp0rk
Just learning the basics so bear with me.
I've tried searching google for this, but I'm not exactly sure what to look for.

Basically, I'm trying to change this:

Code: Select all

public static int size(){
int size = list.size();
return size;
}
to use arrays.

or in other words, what's the correct syntax for passng arrays through methods (both to them and returning an array).

thanks.

Posted: Wed Mar 03, 2004 10:37 am
by scorphus
You could use the ArrayList class, http://java.sun.com/j2se/1.4.2/docs/api ... yList.html which is the default Java2 array management structure.

Scorphus.

Posted: Wed Mar 03, 2004 1:42 pm
by d3ad1ysp0rk
thanks for the link, but I asked my friend in school and he said,

for arraylists:

Code: Select all

public whatever ArrayList name(){
and for arrays:

Code: Select all

either
public whatever int name(){
or
public whatever intї] name(){
or string[]/string or w/e u need.

hopefully these work.. thanks for the help tho :)