+ 2
Type casting / conversion .
you all may have heard of type casting and its types which are implicit type coercion and explicit type casting but is it possible for a string to be casted into char data types? how ?
2 ответов
+ 3
using the character class ---
String a =
"apple" ;
char c= a.chart(0); ➖
// returns 'a'
char[]c_arr=a.toCharArray(); ➖
// returns the length of 4 char ['a','p','p','l','e']
Bidding a farewell to every reader !😀