更新时间:2022-12-24 20:51:19
他们都是等价的。
是的,因为你自己也可以验证。
Yes, as you yourself can also verify.
有编译字节code无差异。
There are no differences in compiled byte code.
这只是写它作为数组索引可以在类型名称之后,以及标识符名称后放的另一种方式。唯一的区别是如果在一个行声明多个变量,如果索引的类型名称后放置,所有列出的标识符将是该类型的数组,而如果该索引标识符名称后放,只有标识符将是一个数组
It is just an alternative way to write it as the array indices can be put after the type name as well as after the identifier name. Only difference is if you declare multiple variable in one line, if indices are placed after the type name, all listed identifiers will be an array of that type, while if the indices are put after the identifier name, only that identifier will be an array.
示例:
String[] array1, array2; // Both are arrays
String array3[], notArray4; // Only array3 is array
我推荐的类型后,将指数(的String []数组1
),所以这将是unambigous。
I recommend putting indices after the type (String[] array1
) so it will be unambigous.
(是否有更多的(几乎相同)的变种除了这四个?)
(Are there more (almost similar) variants apart from these four?)
不,我知道的。