Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Java 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