[WEBINAR] Application Acceleration: Faster Performance for End Users


Definition - What does Array mean?

An array, in the context of Java, is a dynamically-created object that serves as a container to hold constant number of values of the same type. By declaring an array, memory space is allocated for values of a particular type. At the time of creation, the length of the array must be specified and remains constant.

To access an array element, the numerical index (a non-negative value) corresponding to the location of that element must be used. The first index value in the array is zero, thus, the index with value four is used to access the fifth element in the array. An array element that is also an array is known as a subarray. Arrays could have one or two dimensions.

Techopedia explains Array

Arrays have the following advantages:

  • A particular element in a large group of elements may be accessed easily with the array name and the element index.
  • Arrays are useful when executing calculations within a loop.

The declaration and allocation of memory for a one-dimensional array in Java is as follows:
data_type[] array_name = new data_type[length of the array], where data_type is the type of values to be added to the array and array_name is the name assigned to the array.

For example, if we want to create an array named box that includes three elements of type integer, then the following is the Java syntax to define such array: int[] box = new int[3]. To access the first element in this array, the Java syntax used is box[0].

This definition was written in the context of Java

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.