This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Originally posted by satheesh krishnaswamy: Hi, I try to convert an ArrayList into String Array. I am getting "java.lang.ClassCastException:Class cannot be casted to array". I am sure that the ArrayList is not Null.
My ArrayList will contain multiple rows and multiple values. like [a[1,2],b[3,4]]
I need to set 1,2,3 and 4 into individual Values in a Value Object.
How do I do this?
Unfortunately, all the toArray() method does is to create an array where each element is a member of the arraylist. If a member of the list is another arraylist object, or array, it will simply be one element of the array.
I don't believe there is a short cut to do what you want. You will have to write some code that will iterate through the array list, check each member, and do any further iteration if necessary.