String s = "computer";
System.out.println(s.substring(2, 5));What is printed?
- A
mput
- Bcheck_circle
mpu
- C
omp
- D
ompu
Explanation
substring(2, 5) returns characters at indices 2, 3, and 4 (the end index is exclusive), which is "mpu".
AP Computer Science A· difficulty 3/5
String s = "computer";
System.out.println(s.substring(2, 5));What is printed?
mput
mpu
omp
ompu
Explanation
substring(2, 5) returns characters at indices 2, 3, and 4 (the end index is exclusive), which is "mpu".
Want 10 more like this — adaptive to your weak spots?