String s = "hello";
String r = "";
for (int i = s.length() - 1; i >= 0; i--) {
r += s.charAt(i);
}What is r?
- A
hellohello
- Bcheck_circle
olleh
- C
hello
- D
(empty)
Explanation
The loop appends chars in reverse, producing "olleh".
AP Computer Science A· difficulty 2/5
String s = "hello";
String r = "";
for (int i = s.length() - 1; i >= 0; i--) {
r += s.charAt(i);
}What is r?
hellohello
olleh
hello
(empty)
Explanation
The loop appends chars in reverse, producing "olleh".
Want 10 more like this — adaptive to your weak spots?