String s = "abcdef";
System.out.println(s.indexOf("cd"));What is printed?
- Acheck_circle
2
- B
3
- C
1
- D
-1
Explanation
The substring "cd" begins at index 2 in "abcdef".
AP Computer Science A· difficulty 2/5
String s = "abcdef";
System.out.println(s.indexOf("cd"));What is printed?
2
3
1
-1
Explanation
The substring "cd" begins at index 2 in "abcdef".
Want 10 more like this — adaptive to your weak spots?