Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6381817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:26:34+00:00 2026-05-25T02:26:34+00:00

This is a very basic question. The extent of the answer i know to

  • 0

This is a very basic question. The extent of the answer i know to it is that Strings are immutable. Stringbuilders are not, so you can append characters at the end.

So how are stringbuilders internally organized??
String is an array of characters.

Is StringBuilder an array of characters too?
So, I have a StringBuilder MY_OBJ= “Hello”.
Now if i try to append characters to the end of MY_OBJ, does it not mean that you are actually creating a new array object and copying all these chars into a new one? If so how is it more efficient than a string?

And another question I have in mind is, how does one mark the end of a StringBuilder?
Like in C, we use a “/0”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:26:35+00:00Added an answer on May 25, 2026 at 2:26 am

    I dunno. Let’s go see:

    • http://www.docjar.com/html/api/java/lang/StringBuilder.java.html
    72   public final class StringBuilder
    73       extends AbstractStringBuilder
    
    • http://www.docjar.com/html/api/java/lang/AbstractStringBuilder.java.html
    45        * The value is used for character storage.
    46        */
    47       char[] value;
    48   
    49       /**
    50        * The count is the number of characters used.
    51        */
    52       int count;
    

    ===

    Is StringBuilder an array of characters too?

    Apparently, in this particular implementation.

    So, I have a StringBuilder MY_OBJ= “Hello”. Now if i try to append characters to the end of MY_OBJ, does it not mean that you are actually creating a new array object and copying all these chars into a new one?

    Not necessarily. The array isn’t necessarily full (count < value.length), so a new array may not need to be allocated. Ideally, you initialized StringBuilder a capacity so that large enough array was allocated from the start.

    StringBuilder sb = new StringBuilder(20);
    sb.append("Hello");
    ...
    sb.append(" there");
    

    And another question I have in mind is, how does one mark the end of a StringBuilder? Like in C, we use a “/0”

    You don’t care – String/StringBuilder will handle it internally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is a very basic question - but I did not face
This is a very basic question, I'm just not that good with Java. I
I know this is a very basic question. But I am really not able
This is very basic question, many of us didn't know this answer. In java,
This is a very very basic question and I know one way is to
I know this maybe a very basic question but I'm having a bit of
I realise that this is a very basic question, but it is one which
Ok, I know this is a very basic question, but my head is swimming
I know this is a very basic question, but I haven't been able to
This probably is a very very basic question but i can't seem to find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.