This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 9044
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
Similar Threads
Build Array in Servlet And Pass Back to Ajax Callback
how to create array using linked list....
Compare string to a String in array
need read a word of my project . Need help!!!
error please help