ArrayList<String> loc=new ArrayList<String>();
int randnum= (int) (Math.random() * 5);
Integer i=new Integer(randnum);
Wrapping int to a integer object and converting integer object to string
Hope this helps
Welcome to the JavaRanch! We have several dozen forums here, and each forum covers a specific topic. This forum covers JavaServerFaces.
We ask that when you ask a question, you ask it in appropriate forum. You'll find more experts on that topic in the proper forum, you won't clutter forums with questions that have nothing to do with the forum topic, and people who have the same question will be able to find the question and its answer more easily. We have a FAQ on how to use the JavaRanch more effectively.
You can't literally insert an integer into a list of Strings, since that would violate the data typing rules. However, you can convert an integer value into its string representation and store that string in the string list.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Aug 17, 2009
Hey thanks a lot for your help. It worked!
Next time I have a question I'll make sure I post it in the proper forum. Sorry about that..
subject: To insert integer value into an ArrayList<String>