Arrays Java Assignment
Arrays Java Assignment
Define Array:
An array is a collection of similar types of data elements stored in contiguous memory locations.
It is a data structure that can store a fixed-size sequential collection of elements of the same type.
6. The length property provides the total number of elements in the array.
int[] arr;
Define 2D Array:
A 2D array is an array of arrays, also known as a matrix, where data is stored in rows and columns.
Declaration of a 2D Array:
1. Declaration only:
int[][] matrix;
int[][] matrix = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};