Which statement initializes a stringBuilder to a capacity of 128?
A.
StringBuilder sb = new String (“128”);
B.
StringBuilder sb = StringBuilder.setCapacity (128);
C.
StringBuilder sb = StringBuilder.getInstance (128);
D.
StringBuilder sb = new StringBuilder (128);
D
Answer: D
Explanation:
Because new StringBuilder(128) constructs a string builder with no characters in it and an initial capacity specified by the argument.