File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes dynamic arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "dynamic arrays" Watch "dynamic arrays" New topic

dynamic arrays

Thomas Whalen
Ranch Hand

Joined: Aug 26, 2001
Posts: 123
how do i create an array dynamically? i have seen examples of where ArrayB was a copy of ArrayA, but this isn't what I want to do. i want to take a string and create an array that will hold just that string.
thank you,

if you don't know, then ask. if you do know, then share. love is knowledge.
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
Have you seen the API for the String class?

You can use the
void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
method which copies characters from this string into the destination character array.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Thomas Whalen
Ranch Hand

Joined: Aug 26, 2001
Posts: 123
thanks for the example, i didn't even know to look in that API
I agree. Here's the link:
subject: dynamic arrays
jQuery in Action, 3rd edition