|
-
Apr 27th, 2001, 11:44 AM
#1
Thread Starter
Lively Member
Beginner: Dynamic arrays -- without losing values
I'm currently taking my first Java class so bear with me.
The question actually reads: "Create a method to add and
subtract objects".
I assume this means I need to create an array and resize it when
the user wants, preserving the existing values.
---------------------
In Visual Basic it's:
'The next statement resizes the array and erases the elements.
Redim MyArray(10) ' Resize to 10 elements.
'The following statement resizes the array but does not erase
'elements.
Redim Preserve MyArray(15) ' Resize to 15 elements &
'keep existing values.
----------------------
How would I do this with Java?
I apologize for putting a school question here but I can't find
the answer in the text book.
Thanks in advance,
rlb_wpg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|