【发布时间】:2017-05-15 19:31:12
【问题描述】:
通过计算调用行中的下标来访问数组索引中的数据是否合法?像这样:
int[] foo = new int[10];
int bar = foo[3-1]; //attempts to set bar = foo[2]
【问题讨论】:
-
你为什么不试试呢?
-
检查起来比发个问题容易。我确定
-
我不在编译器附近。为未来程序员的利益提出同样问题的问题真的那么可笑吗?
-
未来的程序员会自己尝试。
-
@Cody ideone.com 如果您在 SO 上可用。或者,当然,the language spec。