473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

string builder

36
StringBuilder builder1 = new StringBuilder();
StringBuilder builder2 = new StringBuilder(0);
StringBuilder builder3 = new StringBuilder(100);

System.out.println(builder1.capacity());
System.out.println(builder2.capacity());
System.out.println(builder3.capacity());

16
0
100
can any of tell me that why it give 16 output when first stringbuilder is call because it is empty string builder..........and what capacity do
May 1 '10 #1
1 2237
pbrockway2
151 Expert 100+
Both questions (the capacity of a SB made with the no-arg constructor, and the purpose of "capacity") are covered in the StringBuilder API docs.
May 2 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Karuppasamy | last post by:
Hi I am using a variable of StringBuilder to form a string. After appending a string of value like this {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Verdana;}}
12
by: Tee | last post by:
String Builder & String, what's the difference. and when to use which ? Thanks.
2
by: P K | last post by:
Hi, I have around 30 fields on a screen each one of which I need to validate. The idea was to have a set of messages to be displayed for all the posiible errors instead of having to show a...
4
by: Ahmed Hashish | last post by:
Dear Sir I have a UserControl with a property called 'ConnectionString', How I could trigger the connection string builder to allow users to generate that string in the property sheet. Thanks...
11
by: TheRain | last post by:
Hi, I am trying to append a carriage return to my string using the string builder class, but when I do this the string ends up containing "13". I tried this multiple ways like so ...
3
by: rsine | last post by:
I have searched around a little and have yet to find a naming convention for the string builder object. I really do not want to use "str" since this is for string objects and thus could be...
8
by: simonZ | last post by:
I have Function with string parameteres: public string newLine(String string1,String string2,String string3){ StringBuilder webLine = new StringBuilder(); webLine.Append("<tD nowrap>" +...
3
by: simonZ | last post by:
I read some articles about stringBuilder vs string. I'm using the loop, so I must use string builder. My example: String s1; String s2; String s3; StringBuilder webLines=new...
2
by: rocksoft | last post by:
Hi, I have used stream reader to read text file using Readline method, and i tried to append all string to string builder, but i'm not able to get all string value, i'm only getting last line of...
6
by: mcfly1204 | last post by:
I have a method where I am building an html email. Part of the way through the method, I have an if-statement that direct to another method based off of a field. For example: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.