possibly lossy conversion strange error java
This question already has an answer here:
"Arrays must be indexed by int values... An attempt to access an array component with a long index value results in a compile-time error." --- Wikipedia https://en.wikipedia.org/wiki/Criticism_of_Java#Large_arrays
You cannot initialize an array with a long size. You can only implement an array using an integer size n that satisfies:
0 <= n <= Integer.MAX_VALUE
See Java SE specification > Array Access.
All arrays are 0-origin. An array with length n can be indexed by the integers 0 to n-1.
Arrays must be indexed by int values; short, byte, or char values may also be used as index values because they are subjected to unary numeric promotion (§5.6.1) and become int values.
An attempt to access an array component with a long index value results in a compile-time error .
链接地址: http://www.djcxy.com/p/73644.html上一篇: 如何将字符转换为字符串?
下一篇: 可能有损转换奇怪的错误Java