Assigning a string value to a char
I've been trying to assign a string (consonantString) to a char (consonantChar). I found and tried using the following code:
Since the code assigns a char to a string, I tried changing it so it assigned a string to a char and I ended up with:
String consonantString = (new Character(consonantChar)).toString();
However, the to.Char() caused an error and the program said I should use toCharArray(); instead. When I tried that, it didn't work either.
Char consonantChar = (new String(consonantString)).toChar();
Does anyone know how I can fix that?
Thanks in advance.