When you have a Collection like ArrayList where you don't specify what type of objects are going to be stored, the reference type of the objects when you access them in the Collection will be Object. So you will have to convert what you retrieve from the ArrayList to a String before you try to do something with the elements that requires a String.
Joined: Jan 22, 2006
how do i convert or create a dynamic array as a String?
Joined: Feb 07, 2005
Since toString() is inherited by all class definitions in Java, you can call toString() on any reference, however, depending on the type of object referred to, you may not get very useful information.
But if the objects in the ArrayList are Strings, you can get a reference to the String with toString().