Array program


PROGRAM:

Program to show use of array.

/**
             * @Prof. Jayesh
             * Here an array variable a[], is printing its elements using for loop.
             */

public class ArrayProgram {

            public static void main(String args[])
            {
                        int a[]={1,2,3,4,5};
                        int i;
                        System.out.println("Array members are: ");
                       
for(i=0;i<5; i=i+1)
                        {
                        System.out.println(a[i]);   
                         }
            }
}

OUTPUT:
Array members are:
1
2
3
4

5

Related topics

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.