The charArray() Method:
This method converts all character of a string object into character array. The general form of toCharArray() method is:
char[] toCharArray()
This function is provided as a convenience, since it is possible to use getChars( ) to achieve the same result.
ToCharArray.java
public class ToCharArray
{
public static void main(String arg[])
{
String str="Java Programming";
char[] target=str.toCharArray();
System.out.println(target);
}
}
Output is:
Java Programming
Next Topic Shahbaz
0 comments:
Post a Comment