Friday, 13 June 2014

String (char[] value)

public String(char value[])
Allocates a new String so that it represents the sequence of characters currently contained in the character array argument.

class StringConstructor8{
 public static void main(String args[]){
  char data[] = {'a', 'b', 'c', 'd'};
  String s1;

  s1 = new String(data);
  System.out.println(s1);  
 }
}

Output
abcd



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment