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

  • SEARCH
  • Home
  • 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 3500956
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:47:55+00:00 2026-05-18T12:47:55+00:00

I have a basic question on Java ArrayList . When ArrayList is declared and

  • 0

I have a basic question on Java ArrayList.

When ArrayList is declared and initialized using the default constructor, memory space for 10 elements is created. Now, when I add an 11th element, what happens? Will new memory space be created with 20 (or more) element capacity (this requires copying elements from 1st memory location to new location) OR some thing else?

I checked the ArrayList API documentation for Java 1.4.2. But I didn’t find an answer.

Please share the knowledge.
Thanks.

Edit: New links:

  • ArrayList in the Java 11 API documentation
  • Java(TM) 2 SDK, Standard Edition Documentation 1.4.2
  • 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-18T12:47:56+00:00Added an answer on May 18, 2026 at 12:47 pm

    A new array is created and the contents of the old one are copied over. That’s all you know at the API level. Quoting from the docs (my emphasis):

    Each ArrayList instance has a capacity. The capacity is the size of the array used to store the elements in the list. It is always at least as large as the list size. As elements are added to an ArrayList, its capacity grows automatically. The details of the growth policy are not specified beyond the fact that adding an element has constant amortized time cost.

    In terms of how it actually happens with a specific implementation of ArrayList (such as Sun’s), in their case you can see the gory details in the source. But of course, relying on the details of a specific implementation isn’t usually a good idea…

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

Sidebar

Related Questions

I have a very basic question about MVC web applications in Java. Since the
this is a rather basic java question I have an array containing String that
Sorry for the basic question - I'm a .NET developer and don't have much
This is a really basic question but... I have some code like this var
Another basic Rails question: I have a database table that needs to contain references
I have just started Rails and have a basic question. I need to add
Really basic question I'm sure for some of you Java heads out there. I
This is a very basic question, I'm just not that good with Java. I
Dup of Some Basic PHP Questions Hello, I have a heap of tinyint fields
I have some questions about basic CSS that I was unable to understand or

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.