Results 1 to 2 of 2
  1. #1
    elenora is offline Member
    Join Date
    Apr 2011
    Rep Power

    Cool How to convert array of Objects into array of Strings

    I have an array which is type of Object and it's contents are Strings! I want to put it's contents into an array which is type of String, to convert them I have used toString() method but when I want to use the content of the String Array it's contents are printend wrong!I appreciate if anyone tell me, How could I convert Object into String?

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Rep Power


    Iterate over the first array and put them into the second one?
    Or use the copyOfRange method?
    String[] stringArray = Arrays.copyOfRange(objectArray, 0, objectArray.length, String[].class);

Similar Threads

  1. convert byte array into char array
    By kgkamaraj in forum New To Java
    Replies: 4
    Last Post: 09-13-2011, 12:32 PM
  2. array containing int strings
    By ggalan in forum New To Java
    Replies: 19
    Last Post: 04-22-2011, 05:40 PM
  3. extract strings from an array
    By plasticfood in forum New To Java
    Replies: 18
    Last Post: 10-02-2010, 02:15 PM
  4. Strings as array help please..
    By crazygurl in forum New To Java
    Replies: 1
    Last Post: 12-01-2009, 09:23 PM
  5. Convert Char Array to String Array
    By Mayur in forum New To Java
    Replies: 8
    Last Post: 10-12-2009, 12:41 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