Type casting / conversion . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 ?

23rd Apr 2017, 12:51 AM
Rishabh
Rishabh - avatar
2 Answers
+ 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 !😀
23rd Apr 2017, 1:19 AM
Rishabh
Rishabh - avatar