Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Arrays
An array is used to hold the more than one
number of homogeneous data.
The length of an array is established when t...
Array initialization
The syntax of array initialization is
datatype[] name={item1,item2,...,item n};
OR
name[index positio...
Accessing array elements
Array elements can be either accessed using
their index value or using the looping statements
Exa...
Array resizing
Syntax
aname=Arrays.copyOf(aname, new size);
example
int[] a= new int[4];
a= Arrays.copyOf(a, 8);
Types of array
● One dimensional array
● Two dimensional array
● Multi dimensional array
Two dimensional array
The two dimensional arrays are like a table
The Syntax for declaring a 2-D array is
Dtype [][] name=...
Upcoming SlideShare
Loading in …5
×

intorduction to Arrays in java

412 views

Published on

introduction to arrays

  • Be the first to comment

  • Be the first to like this

intorduction to Arrays in java

  1. 1. Arrays An array is used to hold the more than one number of homogeneous data. The length of an array is established when the array is created. After creation, its length is fixed.
  2. 2. Array initialization The syntax of array initialization is datatype[] name={item1,item2,...,item n}; OR name[index position]= item or value;
  3. 3. Accessing array elements Array elements can be either accessed using their index value or using the looping statements Example System.out.println(a[1]); or for(int i =0 ;some condition; i++) { System.out.println(a[i]);}
  4. 4. Array resizing Syntax aname=Arrays.copyOf(aname, new size); example int[] a= new int[4]; a= Arrays.copyOf(a, 8);
  5. 5. Types of array ● One dimensional array ● Two dimensional array ● Multi dimensional array
  6. 6. Two dimensional array The two dimensional arrays are like a table The Syntax for declaring a 2-D array is Dtype [][] name= new Dtype[size][size];

×