1.

Which of this method of class StringBuffer is used to get the length of the sequence of characters?(a) length()(b) capacity()(c) Length()(d) Capacity()I have been asked this question by my college director while I was bunking the class.The origin of the question is StringBuffer Methods in portion String Handling of Java

Answer»

The CORRECT choice is (a) length()

For explanation: length()- returns the length of String the StringBuffer WOULD create whereas capacity() returns a total number of characters that can be SUPPORTED before it is grown.



Discussion

No Comment Found

Related InterviewSolutions