Arrays - In java arrays are treated as objects.

While using arrays we create objects for arrays where a class is nonexistent. Whenever JVM encounters [] It understands that it has to create an object. Thus array object can be created without using the new operator.

Whenever JVM encounters it understands that it has to create an object. Thus array objects can be created without suing the new operator.

1. One of the particular characteristics of arrays is that, without using the name of the class, we use the new operator to create an array object.

2. In any programming language, we cannot create an array without mentioning the size of the array.

3. Once the size is defined, it is fixed. We cannot alter it during run time.


Int ar1 [ ] = new int [5] \\ here 5 is size of array

Ar1 is a reference to an array of integer type.

System .out .println (ar1 [0]); \\ 0

The above System .out .println statement prints ‘0’ because uninitialized locations would be initialized with their default values.

Example program arrays:

The following program illustrate that the concept of declaring arrays and using them

Class Ademo1


Int ar1 [ ];

Float ar2 [ ] = new float ar2 [3];

Public static void main (string args [ ])


Ademo1 a1 = new Ademo1 ();

System .out .println (a1 .ar1); \\ a1.ar1 = null.

System .out .println (a1. ar2); \\ address will be printed

a1 .ar2 [1] = 67f;

a1.ar1 = new int[3];

System .out .println (a1 .ar1 [1]); \\ 0 is printed.

a1. ar1 [a1 .ar1. length -1] =12;

int ar1 [ ] = new int [4];

For (int i=0; i< ar1. length; i++)


ar1 [i] = i*I;


For (int j=0; j< ar1. length; j++)


System .out .println (ar1 [j]);

} \\ end main

} \\ end class

Java Homework Help in Arrays provides java homework help, java homework assignments, java homework solutions, do my java assignment, java project help, live java programming homework help, Matlab programming assignment help, help with java programming assignment, Professional Java Assignment Help, Java Programming Help, Java Assignment Help, Get Help with Java Assignment at the affordable price with high quality & plagiarism free work.