0
How to get first char in string in Java
I have some string and I have to get zero index of string. But it throws error, strings isn't indexed and arrays indexed only. How yo get zero index of string?
2 Answers
+ 4
You can use charAt(index) or toCharArray() method.
+ 4
char ch = string.charAt(0);