Skip to main content

Array in Java

Learn Array in Java (Java Basics, Java) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

1. Introduction An array is a container object that holds a fixed number of values of the same type in contiguous memory . Each element has an index starting at 0, the size is fixed at creation with new and read through the length field, and elements get default values (0, false, null ). Arrays are heap objects with a header and a length, so an array variable holds a reference They are covariant, and a 2D array is an array of arrays that can be jagged.

More lessons in Java Basics