Oracle Certified Associate Java Se 8 Programmer · Free Practice Question Hard
Question 34
Consider the following code:
- public class Test
- {
- public static void main(String[] args)
- {
- StringBuilder sb = new StringBuilder("Java8");
- sb.reverse().deleteCharAt(0).append("SE").delete(3,sb.length());
- System.out.println(sb);
- }
- }
What is the result ?
-
A
ava8 4
-
B
JavaSE8 7
-
C
Java 4
-
D
ava 3
Reveal correct answer
Correct answer: D
Explanation
After applying all the operations, the content of StringBuilder is ava. Hence the output is: ava 3Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
You must be logged in to post a comment.
