是否将尾随逗号放入数组中在性能上有差异吗?

Is there a difference in performance whether I put the trailing comma in array, or not?

在 Thinking in Java 我读过的书第 4 版中,在列表中的最后一个对象之后留下逗号 可以更容易地自动生成此类列表,但它是可选的 .
另一方面 here,在 Java SE 规范中我可以阅读,尾随逗号被忽略
关于 Whosebug 问题,我读到它使代码更易于维护
但我想问你,这对 JVM 的工作有什么影响吗?我推断这只是一个好习惯,对吗?如果性能没有差异,我应该使用它作为默认值吗?
哪个版本在实践中使用的比较频繁?
这是显示问题的示例代码:

Integer[] arrFst = new Integer[]{new Integer(1), new Integer(2), };
Integer[] arrSnd = new Integer[]{new Integer(1), new Integer(2) };

感谢您的回答。

In Thinking in Java book 4th edition I read, that leaving the comma after the last object in list makes automatic generating such lists easier, but it is optional.

正确。

On the other hand here, in Java SE Specifications I can read, that trailing comma is ignored.

正确,但没有 'on the other hand'。它被忽略了。由编译器。以上两种说法不冲突

On Whosebug questions I read that it makes code easier to maintain.

再次更正。

But I would like to ask you if it makes any difference for the JVM work?

不,因为它被编译器忽略了,所以 JVM 甚至看不到它。

I deduce that it's only a good practice, am I right?

这是一种可选的做法,在某些情况下很有用。

If there is no difference in performance, should I use it as default?

没有,为什么?

Which version is used in practice more frequently?

如果不完整调查现有的所有 Java 代码,或者没有足够的代码构成具有统计意义的样本,则无法回答。在任何情况下,你都应该做对你最有利的事情,而不是从统计上来说每个人都做的事情。