Sunday 27 December 2015

single dimensional array in java with it's example

One dimensional array is a list of variables of same type that are accessed by a common name. An individual variable in the array is called  an array element.



## Example :


/**


 *


 * @author pradeep


 */


class ArrayDemo {


    public static void main(String[] args) 
{


        /*int marks[]=new int[5];


        marks[0]=33;


        marks[1]=65;


        marks[2]=69;


        marks[3]=78;


        marks[4]=86;
        * */
        //int marks[]=new int[]{33,65,69,78,86};
        int marks[]={33,65,69,78,86};
        for(int i=0;i<5;i++)
        {
            System.out.println("print marks:"+marks[i]);
        }
    }
    
}

No comments:

Post a Comment