In java how we can parse the character?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In java how we can parse the character??

as we know to parse integer using we do lets suppose integer i ; so we do i = next.Int(system.in) ,what we do in case of character??

19th Feb 2017, 12:36 PM
Amar Singh
Amar Singh - avatar
1 Answer
+ 5
You can use the String method toCharArray: String str = "test"; char[] c = str.toCharArray(); Or charAt for only one char, here first char of the String: char c = str.charAt(0);
19th Feb 2017, 1:12 PM
Tashi N
Tashi N - avatar