Results 1 to 2 of 2
  1. #1
    leda is offline Member
    Join Date
    Nov 2010
    Posts
    3
    Rep Power
    0

    Default create string from array of chars

    I want to create string from array of chars
    char [] array = {'H','e','l','l','o',',',' ','w','o','r','l','d','!' };

    1) String s = new String(array);
    2) String s = String.valueOf(array);

    Is this the same thing?
    what is the differance?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,939
    Rep Power
    8

    Default

    Look up each method in the API: String (Java Platform SE 6)

    Then you tell us what you think the difference is.

Similar Threads

  1. Make String into chars
    By myst in forum New To Java
    Replies: 19
    Last Post: 06-20-2010, 04:24 PM
  2. Swap chars in a String?
    By spatel14 in forum New To Java
    Replies: 5
    Last Post: 06-08-2010, 09:05 PM
  3. create a 2d char array from a 1D string array
    By jschmall12 in forum New To Java
    Replies: 1
    Last Post: 04-27-2010, 09:01 PM
  4. Replacing the chars within a string.
    By Mayur in forum New To Java
    Replies: 2
    Last Post: 03-27-2009, 04:00 AM
  5. How to print chars with symbols from a string
    By blacksky in forum New To Java
    Replies: 23
    Last Post: 01-06-2009, 01:14 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
  •