Question PRG-JAVA-0063
HardWhat is the output of this program?
public class Main {
public static void main(String[] args) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 5; i++) {
if (i % 2 == 0) sb.append(i);
else sb.insert(0, i);
}
System.out.println(sb);
}
}
- A.
01234
- B.
13024
- C.
Sign up free to see the answer and a step-by-step explanation.