The usage of ToCharArray() converts characters in a string object into a character array.
The detailed explanation is:
After the string is converted into a character array, the ASC code of each character is performed in binary XOR operation with the ASC code of character T.
Finally convert the result back to characters.
Give an example:
public class Test {
public static void main(String args[]) {
String Str = new String(“”);
("Return value:");
( () );
}
}
The above program execution results are:
Return value:
ToCharArray( ) Other examples
String myString=“abcd”;
char myChar[]=();
(“myChar[1]=”+myChar[1]);
Output result:
myChar[1]=b
explain:
There are four characters in this string: a, b, c, and d.
Convert to array element myChar[1] is the second element of the array.
That is, myChar[1]=b.