Intro to Java Primitive Arrays

by Dan Bunker

 

Arrays in Java

 

Primitive arrays are one of the core built in data types in Java. The array is one of the most basic data structures used in computer science. This codecast will cover what arrays are and how you can declare them in Java.

Other languages sometimes refer to arrays as associative arrays or ordinal maps. Thats because the elements contained in the array are indexed via an integer position. In other words, each element is mapped or associated with a number.  The beginning of the array begins at position zero and increases by one for each element in the array.

Primitive arrays in Java are fixed in size. When you declare the array, the size you give the array is the set size for that array until it's either converted to another larger or smaller array instance or it's garbage collected. These arrays are considered static, meaning that can't dynamically change the total number of slots that can hold elements.