title: Array index property in Java
body: <p>I am new to Java programming and I am working with arrays .In arrays 
  index needs to be an integer and it doesn't allow float or double so I used long data type for index and it gave error. Whereas when I used byte and short and Int it worked . I want to know since the error was "possible lossy conversion from long to int "
  Is it such that only int is allowed in index and since byte and short are small in size that's why it worked (auto promotion) and long was larger than int so it gave error(no auto depromotion)plz help</p>
  
  <pre><code>  import Java.util.*;
    class Demo{ 
  public static void main(String args[]){
          long n=5;
          int a[]=new int[n]; //error possible lossy conversion from long to int
          System.out.println(Arrays.toString(a));
      }
  
     }
  </code></pre>