public static int run() {
String s = "Hello World";
return s.indexOf('o') + s.lastIndexOf('o') + s.length();
}
// Call: System.out.println(run());What is printed?
- Acheck_circle
22
- B
16
- C
21
- D
23
Explanation
indexOf('o')=4, lastIndexOf('o')=7, length=11. 4+7+11 = 22.