+ 4
How can I convert string into a char in java ?
Need explanation with example......
5 Answers
+ 6
@abhishek
No, a String cannot be casted to a Char like that.
You could also do:
myString.toCharArray()[index];
Though, better to use charAt, unless you plan on using more than one character
+ 3
thanks @ ace
+ 3
@ Rrestoring faith ,
agreed
0
char stores single letter and string store more than 1. to covert it we typecast given string(It should have just single letter!!!)
a= (char)b. where b is string type