Results 1 to 3 of 3
  1. #1
    JonJacobs is offline Member
    Join Date
    Jul 2010
    Posts
    34
    Rep Power
    0

    Default String[] stored in ArrayList

    I created and ArrayList and stored string arrays in it. No problem.
    String[] a = {"this","that","other"};
    arr.Add(a);

    But I also want to get the string arrays back out of the ArrayList. Problem!
    String[] s = (String[]) arr.get(0);

    That won't compile. What can I do to make it work?

    Thanks,
    Jon Jacobs
    This message was composed entirely from recycled electrons.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,891
    Rep Power
    25

    Default

    That won't compile
    please copy and paste full text of the error message here.
    The message will tell us what the problem is.

  3. #3
    JonJacobs is offline Member
    Join Date
    Jul 2010
    Posts
    34
    Rep Power
    0

    Default

    Thanks, Norm. I went back to my code and found a typo. When I corrected it, the code compiled and worked.
    Jon Jacobs
    This message was composed entirely from recycled electrons.

Similar Threads

  1. Replies: 0
    Last Post: 03-16-2010, 12:08 PM
  2. Replies: 2
    Last Post: 03-16-2010, 08:01 AM
  3. Class Instances stored in an ArrayList
    By Ersk in forum New To Java
    Replies: 4
    Last Post: 12-12-2009, 05:13 PM
  4. Putting a string into ArrayList<String>
    By k4ff1n34dd1c7 in forum New To Java
    Replies: 5
    Last Post: 03-23-2009, 06:10 PM
  5. how to store an ArrayList<string> into cookies?
    By perplexingtrax in forum Java Servlet
    Replies: 7
    Last Post: 01-12-2009, 01:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •