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 6248965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:09:12+00:00 2026-05-24T13:09:12+00:00

Is creating an array and creating an arraylist the same thing in Java? I

  • 0

Is creating an array and creating an arraylist the same thing in Java? I hear many different stories with regard to this so if you could point me into the right direction it would much appreciated 🙂

  • 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-24T13:09:14+00:00Added an answer on May 24, 2026 at 1:09 pm

    An array is a primitive structure. It is sequential memory and allocated by the JVM.

    An arraylist uses an array behind it, but you don’t have direct access to it. It can “grow” while a regular array cannot.

    Basically, an arraylist starts (by default) with an array of length 10 behind it, and a count of 0. So imagine you had

    ArrayList<Integer> myInts = new ArrayList<Integer>();
    

    behind this is an array like this

    count = 0
    array = [ null, null, null, null, null, null, null, null, null, null ]
    

    When you go myInts.add(5); it does this

    count = 1
    array = [ 5, null, null, null, null, null, null, null, null, null ]
    

    If you added more you could get this

    count = 10
    array = [ 5, 4, 3, 2, 1, 5, 8, 3, 0, -1 ]
    

    And if you added one more (which would push it beyond its capacity) it would make a new array to support it

    count = 11
    array = [ 5, 4, 3, 2, 1, 5, 8, 3, 0, -1, 9, null, null, null, null, null, null, null, null, null ]
    

    You can change the size of the backing array if you want to. for example:

    myInts.trimToSize();
    
    count = 11 // hasn't changed
    array = [ 5, 4, 3, 2, 1, 5, 8, 3, 0, -1, 9]
    
    myInts.ensureCapacity(15);
    
    count = 11 // hasn't changed
    array = [ 5, 4, 3, 2, 1, 5, 8, 3, 0, -1, 9, null, null, null, null,]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an array like this: function imageSize($name, $nr, $category){ $path = 'ad_images/'.$category.'/'.$name.'.jpg';
I'm creating an array of BackgroundWorker that shares one event handler like this: BackgroundWorker[]
I don't think I am creating this array of UILabels correctly. If I put
Basically, what I want is like this creating variable names from an array list
I am using MSChart and I am creating array like this DataPoint[] datapoint =
I am creating an array of string objects in PowerShell which needs to be
Why is it that for user defined types when creating an array of objects
When creating a 3D array in C#, which is a better way to create
I'm creating a numpy array which is to be filled with objects of a
If you are creating a 1d array in Python, is there any benefit to

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.