| Author |
Creating Stings Dynamically
|
Steve Dyke
Ranch Hand
Joined: Nov 16, 2004
Posts: 1254
|
|
I need to loop through an array and create String objects. How can I get this to work?
>
|
 |
Marky Vasconcellos
Ranch Hand
Joined: Jan 28, 2009
Posts: 36
|
|
It's impossible.
I found the same question a while ago in other forum.
But.. i suggest you store all it on a ArrayList and to access you can use it using the get(int index) from the List interface.
|
Each of their nuggets of wisdom contracted to a sound bite: Joshua Bloch: Write Lots of Code; Chet Haase: Don't Put Your Entire Application in One Method; Masood Mortazavi: Start Simple and Keep Learning; Cay Horstmann: First, Don't Panic
|
 |
Malcolm Storey
Ranch Hand
Joined: Nov 09, 2008
Posts: 31
|
|
It really depends on what you're trying to achieve. If you just want some sort of formatting on the original objects, give them a method to return an appropriately formatted String.
|
Malcolm
I wouldn't join any Collection with an add() method that would accept me as a parameter
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
If you need the contents of each "variable" as well, try a map:
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Creating Stings Dynamically
|
|
|