How to find the length and capacity of a string buffer ?

Answers were Sorted based on User's Feedback



How to find the length and capacity of a string buffer ?..

Answer / vijayakumar chinnasamy

StringBuffer conatain a method called length() to find out
the length and capacity() to findout the capacity of
stringbuffer.

ex:
StringBuffer buffer=null;
buffer.length();
buffer.capacity();

Is This Answer Correct ?    6 Yes 0 No

How to find the length and capacity of a string buffer ?..

Answer / therathna

By using length and capacity methods.


For this use JDK api we get complete details

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More Core Java Interview Questions

what are depricated methods ?

5 Answers   Satyam,


What is the internal implementation of set in java?

0 Answers  


What is module in project?

0 Answers  


Can you give names of Container classes?

0 Answers   Ordain Solutions,


How to validate the request (Eg:user name and password) in session(http session)? not in LDAP server ?

1 Answers   Saksoft,






public class Test { public static void main(String[] args) { int countA = 0; int countB = 0; int countC = 0; int countD = 0; int countE = 0; int countF = 0; int countG = 0; int countH = 0; int countI = 0; int countJ = 0; int countK = 0; int countL = 0; int countM = 0; int countN = 0; int countO = 0; int countP = 0; int countQ = 0; int countR = 0; int countS = 0; int countT = 0; int countU = 0; int countV = 0; int countW = 0; int countX = 0; int countY = 0; int countZ = 0; } } Can anybody tell me any alternate solution(like loop or something) to automate this initialization process. Ex:- for(char chr='A';chr<='Z'; chr++) { (int) String "count"+chr = 0; }

0 Answers  


What is module with example?

0 Answers  


what is net based application and its types

1 Answers  


What is join () in java?

0 Answers  


Is Java a dying language?

0 Answers  


Why java is free from garbage values??

4 Answers  


How to restrict a member of a class from inheriting by its sub classes?

0 Answers  


Categories