[Solved] Is arithmetic allowed in a Java array subscript? [closed]


Yes. Any calculation that ends up in an int can be used in an array access. (It can throw if it’s outside the array range or negative, of course, but it’ll compile.) The JLS specifies this behavior.

solved Is arithmetic allowed in a Java array subscript? [closed]