Results 1 to 5 of 5
  1. #1
    Preethi is offline Member
    Join Date
    Jan 2008
    Posts
    83
    Rep Power
    0

    Default Converting object to string

    How to convert an arrayObject into String Object?

    Thank you..

  2. #2
    hey
    hey is offline Member
    Join Date
    Dec 2007
    Posts
    21
    Rep Power
    0

    Default

    what do you mean by arrayObject?

    probably this will work ?

    string = (String) arrayObject;

  3. #3
    JAdmin is offline Member
    Join Date
    Jan 2008
    Posts
    20
    Rep Power
    0

    Default

    You mean an object in an Array?
    If so, as hey pointed out, cast the value to String. (Note: All values in Array and other collection classes are stored as objects. So when you retrieve them you need to cast them back to their original type)

    Hope this helps
    Sincerely, Your friends at www.javaadvice.com

  4. #4
    mars_red is offline Member
    Join Date
    Feb 2008
    Posts
    3
    Rep Power
    0

    Default

    thank you for the help i am still trying to work on it .

  5. #5
    ferranb is offline Member
    Join Date
    Jun 2008
    Posts
    22
    Rep Power
    0

    Default

    Hope this helps

    Object[] object_array = {xxx, xxx};
    String[] string_array = new String[object_array.length];
    for (int i = 0 ; i < object_array.length ; i++)
    string_array[i] = object_array[i].toString();

Similar Threads

  1. Object from String (calling method dynamically)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-16-2008, 09:22 PM
  2. Object from String
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-16-2008, 09:20 PM
  3. Converting String to Double
    By srini in forum New To Java
    Replies: 1
    Last Post: 12-24-2007, 08:03 PM
  4. Converting Epoch to string Date
    By amyedwards in forum New To Java
    Replies: 3
    Last Post: 12-14-2007, 10:33 PM
  5. String vs Object
    By Gilgamesh in forum New To Java
    Replies: 1
    Last Post: 11-28-2007, 10:26 PM

Posting Permissions

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