Thursday, 26 January 2012

Declaring Array in Java Language

class ArrayExample
    {
    public static void main(String abc[])
        {

             //Array Are Objects in Java
                 
            //int []a={2,4,6,8,10,12,14,16,18,20};
                          
                  int[] a=new int[10];
                             
                       for(int i=0; i<=9; i++)
            {
                     a[i]=2+i;


                   
            System.out.println(a[i]);
               
            }//end of the loop


        }//end main function
    }//end class

No comments:

Post a Comment