Manu asked:
>>[snip]I want to know whether the class defination having an
>>int type member variable(say x) and an array with the index as x is correct
>>or not. If not what could be the way to handle arrays whose maxlength is not
>>fixed but depends on something else...
Thomas Paul responded:
> Use a vector object
Not to re-introduce the Vector vs array argument, but merely to answer
the original question:
Yes, you can say something like
public int[] makeArray(int size) {
int[] intArray = new int[size];
return intArray;
}
... or include the array creation anywhere in your code, or whatever.
Just as long as you know the size of the array right before you create
it...
You should only use a Vector (or other "dynamically" sizing object) if
you want to be able to add an arbitrary number of objects to your data
structure - that is, if you don't know how many objects you're going to
need to store (even at run time), but rather need the ability to let the
structure grow dynamically...
--
Within C++ is a smaller, cleaner language
struggling to get out.
It's called Java.
Thomas Moore
[EMAIL PROTECTED] Home Account
Software.Engineer [EMAIL PROTECTED]
phone://732.462.1880:268 NJ Patterns Group Home Page
employer://Celwave, RF http://members.home.net/twmoore/cjpg
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html