The author of this method forgot to include the data type.
Which of the following reference types can best fill in the blank to complete this method?
public static void m(____ v) { char ch = v.charAt(3); v = v.insert(1, "more"); int num = v.length(); }
C.
ArrayList has a size()
method rather than a length()
method, making Option A incorrect.
The charAt()
and length()
methods are declared on both String and StringBuilder.
The insert()
method is only declared on a StringBuilder and not a String.
Option C is correct.