ScannerObject.next().CharAt(0) what is 0 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

ScannerObject.next().CharAt(0) what is 0

11th Jul 2018, 9:19 PM
Javed Shaikh
Javed Shaikh - avatar
2 Answers
+ 2
ScannerObject.next() will accept string as input. charAt(int index) is a predefined method of String class which extracts the character at index passed in arguement from string. Index start from 0. so, charAt(0) will extract the first character of the string that has been accepted by ScannerObject.next()..
12th Jul 2018, 5:17 AM
Jain Rishav Amit
Jain Rishav Amit - avatar
+ 1
thanks
12th Jul 2018, 5:06 AM
Javed Shaikh
Javed Shaikh - avatar