Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

the capacity() method

 
Khurram Ajmeri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello there
how does capacity() method in StringBuffer work?
 
Azam Bukhari
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Capacity() method for the string buffer works as follows...
The default length of a String buffer object is 16 initially.
When we initialize this object with a string let be it like "Paki" then when u go & try out the length of this Buffer object u ll get 4 but when u go & try to find out the capacity()...it will return 16...
In other words its a tring with no limitation or boundaries
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic