Below method: with Built in
String str="Google";
char[] arr=str.toCharArray(); // What is the wrong with this way
Below method: without Built in method.
String str="Google";
char[] arr=new char[str.length()];
for (int i=0;i<str.length();i++){
arr[i]=str.charAt(i);
}
No comments:
Post a Comment