Embed presentation
Download to read offline


![One dimensional array
An array which has one index is known as One dimensional array.
To use an array in a program, you must declare a variable to reference
the array, and you must specify the type of array the variable can
reference. Here is the syntax for declaring an array variable:
dataType[] ArrayName; // preferred way.
or
dataType arrayRefVar[]; // works but not preferred way](https://image.slidesharecdn.com/chapter6java-170730080004/75/Chapter-6-java-3-2048.jpg)
![Continue..
You can create an array by using the new operator with the following
syntax:
ArrayName = new dataType[arraySize];
The above statement does two things:
It creates an array using new dataType[arraySize];
It assigns the reference of the newly created array to the variable](https://image.slidesharecdn.com/chapter6java-170730080004/75/Chapter-6-java-4-2048.jpg)
![Two dimensional array
An array which has two indexes is known as two dimensional array, the
steps needed for declaration and creation of two dimensional array is
same like one dimensional array with little difference.
Here is the syntax for declaring array variable:
Data_type[][] array_name// mostly preferred
Or
Data_type array_name[][]// will work but not preferred](https://image.slidesharecdn.com/chapter6java-170730080004/75/Chapter-6-java-5-2048.jpg)
![Continue..
After declaring an array name then one can create an array with
specific size:
Array_name = new data_type[index1][index2];](https://image.slidesharecdn.com/chapter6java-170730080004/75/Chapter-6-java-6-2048.jpg)


This document discusses arrays in Java, including one-dimensional and two-dimensional arrays. It defines an array as a set of consecutive memory locations that can store the same data type with a common name. It explains that one-dimensional arrays use a single index while two-dimensional arrays use two indexes. It provides the syntax for declaring and creating both one-dimensional arrays, using the new operator, and two-dimensional arrays, specifying the size with two indexes.


![One dimensional array
An array which has one index is known as One dimensional array.
To use an array in a program, you must declare a variable to reference
the array, and you must specify the type of array the variable can
reference. Here is the syntax for declaring an array variable:
dataType[] ArrayName; // preferred way.
or
dataType arrayRefVar[]; // works but not preferred way](https://image.slidesharecdn.com/chapter6java-170730080004/75/Chapter-6-java-3-2048.jpg)
![Continue..
You can create an array by using the new operator with the following
syntax:
ArrayName = new dataType[arraySize];
The above statement does two things:
It creates an array using new dataType[arraySize];
It assigns the reference of the newly created array to the variable](https://image.slidesharecdn.com/chapter6java-170730080004/75/Chapter-6-java-4-2048.jpg)
![Two dimensional array
An array which has two indexes is known as two dimensional array, the
steps needed for declaration and creation of two dimensional array is
same like one dimensional array with little difference.
Here is the syntax for declaring array variable:
Data_type[][] array_name// mostly preferred
Or
Data_type array_name[][]// will work but not preferred](https://image.slidesharecdn.com/chapter6java-170730080004/75/Chapter-6-java-5-2048.jpg)
![Continue..
After declaring an array name then one can create an array with
specific size:
Array_name = new data_type[index1][index2];](https://image.slidesharecdn.com/chapter6java-170730080004/75/Chapter-6-java-6-2048.jpg)
