nerdexam
Oracle

1Z0-819 · Question #128

Given public class Tester { public static void main(String[] args) { StringBuilder sb = new StringBuilder(5); sb.append("HOWDY"); sb.insert(1, "LL"); sb.replace(3, 5, "COW"); sb.delete(2, 7)…

The correct answer is A. 4. See the full explanation below for the reasoning.

Question

Given public class Tester { public static void main(String[] args) { StringBuilder sb = new StringBuilder(5); sb.append("HOWDY"); sb.insert(1, "LL"); sb.replace(3, 5, "COW"); sb.delete(2, 7); System.out.println(sb.length()); } } What is the result?

Options

  • A4
  • B3
  • CThe code does not compile
  • D5

How the community answered

(38 responses)
  • A
    84% (32)
  • B
    8% (3)
  • C
    3% (1)
  • D
    5% (2)

Community Discussion

No community discussion yet for this question.

Full 1Z0-819 Practice