- 1

Question of Java

I have the word ( for example: motherfucker),how to output its k-th character of this word

12th Oct 2017, 10:50 AM
Женя Сторожев
Женя Сторожев - avatar
1 Answer
+ 11
You can use the charAt() method to get the element at any specified index. For eg, String str = "This is a String"; char result = str.charAt(8); // now result holds 'a'
12th Oct 2017, 10:59 AM
Dev
Dev - avatar