Search This Blog

Wednesday, 9 April 2014

java program to convert char array to String

java program to convert char array to String



public class ConvertCharArrayToString {
       public static void main(String[] args) {
              char[] charArr = { 'w''e''l''c','o','m','e',' ','R''a',' j' };

              String str = new String(charArr);
              System.out.println("converted String is:" + str);

              String str1 = String.valueOf(charArr);
              System.out.println("covnverted String is:" + str1);
       }
}

OUTPUT
converted String is:welcome Raj
covnverted String is:welcome Raj

No comments:

Post a Comment