Various ways of accessing an array
<p>Today i did learn two ways of accessing the array, i would like to know the various ways of accessing an array element and the best practice of it. I am a student learning algorithm.</p>

<pre><code>int [] arr;
long [] arr;
</code></pre>

<p>Advantages of long datatype declaration over int. </p>

<pre><code>class ArrayApp{

    public static void main(final String[] args){

 long [] arr; 
    arr= new long[2];
 int i;
 arr[0]=112;
 arr[1]=111;

    **// Way one**

 for(long l:arr) 
 {
 System.out.println(l);
 }

    **// Way Two**

 for(i=0;i&lt;arr.length;i++) {
 System.out.println(arr[i]);
 }

    } 
} 
</code></pre>
