Explanation: Given method is declared as default method so we can use it only inside an interface. Hence option 1is correct and option 4 is incorrect. Option 1 is incorrect as it is valid method. Option 3 is incorrect as return type is void, which means we can't return anything.
Question : Which statement initializes a stringBuilder to a capacity of ?
Correct Answer : Get Lastest Questions and Answer : Explanation: StringBuilder(int capacity) Constructs a string builder with no characters in it and an initial capacity specified by the capacity argument. Note: An instance of a StringBuilder is a mutable sequence of characters. The principal operations on a StringBuilder are the append and insert methods, which are overloaded so as to accept data of any type. Each effectively converts a given datum to a string and then appends or inserts the characters of that string to the string builder. The append method always adds these characters at the end of the builder; the insert method adds the characters at a specified point.