- 1
Question of Java
I have the word ( for example: motherfucker),how to output its k-th character of this word
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'