java foreach和匿名数组的问题
PHP中文网
PHP中文网 2017-04-18 10:38:16
0
2
612
PHP中文网
PHP中文网

认证0级讲师

reply all(2)
大家讲道理

The object traversed must be object, not a basic type. Array types are not classes, but array instances are objects. But in this case, your array has not yet become an instance, so an error is reported.

黄舟

The second syntax is incorrect. There is no such way of writing in Java.

for (int a:new int[] {3,4}) {
    System.out.println(a);
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template