Which statement initializes a stringBuilder to a capacity of 128?

Which statement initializes a stringBuilder to a capacity of 128?

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);



Leave a Reply 2

Your email address will not be published. Required fields are marked *


imyrta

imyrta

Answer: D

Explanation:

Because new StringBuilder(128) constructs a string builder with no characters in it and an initial capacity specified by the argument.