Road Map

Heap Space vs. Stack Memory

Java Heap Space vs. Stack Memory: How Java Applications Allocate Memory

Arrays

It is data structure use to store a collection of data.

  1. An array is fixed length or size.
  2. An Array can be created using both primitive datatypes datatypes as well as non-primitive data types.

Untitled

datatype[] varible-name = new datatype[size];

Untitled

ArrayList

ArrayList is a part if collection framework and is present in java.util.package . It provides us with dynamic arrays in Java. It is slower than standard Arrays.

  1. An ArrayList can contain as many elements as you want even though an initial size is specified.
  2. An ArrayList cannot be created using primitive datatypes. It can only be created using objects or wrapper classes.
ArrayList<Integer> list = new ArrayList<Integer>();
						👆
					add wrappers

Untitled