File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Creating Stings Dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Creating Stings Dynamically" Watch "Creating Stings Dynamically" New topic
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: Creating Stings Dynamically
 
Similar Threads
AWT
Java Swing
Arrays
how do i access the text on the label for mouseClicked..??
Consider this code.