1. Home
  2. Java
  3. Arrays
  4. Single-Dimensional Array

Single-Dimensional Array

An array is a set of elements of the same data type determined by a single variable name. Each array element can be referred to by specifying the array name, followed by a subscript, enclosed in square brackets. Arrays may be one-dimensional or multi-dimensional, depending upon whether one or more subscripts identify each element of the array. Thus, if marks is a one-dimensional array containing n elements, the individual array elements will be marks[0], marks[1],…… marks[n-1]. Since only one subscript or index follow the variable name marks, therefore, this array is called one-dimensional array. The value of the array elements can be assigned as follows: