Monday 23 June 2014

toCharArray ()

public char[] toCharArray()
Converts this string to a new character array.

class StringToCharArray{
 public static void main(String args[]){
  String str = "efghijklm";
  char arr[] = str.toCharArray();
  
  for(char c : arr)
   System.out.println(c);
 } 
}

Output
e
f
g
h
i
j
k
l
m



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment