Arrays Introduction Tutorial Properties

Arrays Introduction Tutorial Properties

Summary: This tutorial "Arrays Introduction Tutorial Properties", discusses arrays properties in simple terms, example code and screenshots. Start reading.

Array is a data structure capable to hold data of similar data types. Every language comes with its own rules for arrays. For example, JavaScript and VBScript comes its own set of rules, quiet different from Java. Arrays of Java are similar to C/C++.

Arrays Introduction Tutorial Properties

Following are the properties of arrays as accepted by the Java compiler.

  1. Arrays stores similar data types. That is, array can hold data of same data type values. This is one of the limitations of arrays compared to other data structures.
  2. Each value stored, in an array, is known as an element and all elements are indexed. The first element added, by default, gets 0 index. That is, the 5th element added gets an index number of 4.
  3. Elements can be retrieved by their index number.
  4. Array elements are stored in contiguous (continuous) memory locations.
  5. Once array is created, its size is fixed. That is, at runtime if required, more elements cannot be added. This is another limitation of arrays compared to other data structures.
  6. One array name can represent multiple values. Array is the easiest way to store a large quantity of data of same data types. For example, to store the salary of 100 employees, it is required to declare 100 variables. But with arrays, with one array name all the 100 employees salaries can be stored.
  7. Arrays can be multidimensional.
  8. At the time of creation itself, array size should be declared (array initialization does not require size).
  9. In Java, arrays are predefined objects. With methods, the array elements can be manipulated.
  10. As Java does not support garbage values, unassigned elements are given default values; the same values given to unassigned instance variables.

Can you answer these Questions?

2 thoughts on “Arrays Introduction Tutorial Properties”

Leave a Comment

Your email address will not be published.