认证0级讲师
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.
Java
for (int a:new int[] {3,4}) { System.out.println(a); }
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
.