Possible Lossy conversion from long to int

后端 未结 6 692
借酒劲吻你
借酒劲吻你 2021-01-01 02:15

I wish to enter one int and another long ex: 1 and 1000000000, and now I wish to create an array of size 1000000000. And then at each index of arra

6条回答
  •  死守一世寂寞
    2021-01-01 03:05

    Array index is an integer in Java and the compiler will advice you. So maximum array size is (aproximately) Integer.MAX_VALUE. For bigger arrays you should use ArrayList.

    To go around this dirt&quick

    arr = new long[(int)y+1];  
    

提交回复
热议问题