How can you change the length of a String in a StringBuilder object?
What will be an ideal response?
You can change the length of a string in aStringBuilderobject with thesetLength()method. Thelengthof a StringBuilder object equals the number of characters in theStringcontained in theStringBuilder. When you increase aStringBuilderobject's length to be longer than theStringit holds, the extra characters contain ‘\u0000'. If you use thesetLength()method to specify a length shorter than itsString, the string is truncated.
You might also like to view...
If a header node is used, which of the following indicates a list with one item?
a. header!=NULL b. header==NULL c. header!=NULL && header->next==NULL d. header!=NULL && header->next!=NULL && header->next->next==NULL e. none of the above
Consider a DRM-SWWSN where there are N nodes spread across an area of Am 2 in a uni- form distributed manner. Assume that all nodes have H-sensor capability. For a directed angle of ? = 30 degrees, estimate the mean number of members in the DNT given the prob- ability p = 0.2. What are the impacts of having a very small number of members in the DNT?
What will be an ideal response?