带括号语法的Java函数定义 [英] Java function definition with brackets syntax
本文介绍了带括号语法的Java函数定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在源代码中查找ByteArrayOutputStream
,我看到了此功能:
Was looking in the source for ByteArrayOutputStream
, and I saw this function:
public synchronized byte toByteArray()[] {
return Arrays.copyOf(buf, count);
}
此语法在哪里记录?我的意思是该功能前面的[]
.
Where is this syntax documented? I mean the []
in front of the function. Is this the same as in declaring a regular array where the bracket can go after the name of the array or before, but in this case, the bracket can go after the function name?
String[] args;
VS
String args[];
2018-05-22
我在这里发现了这种疯狂语法的更多用法:关于Java的十件事
I found even more uses of this crazy syntax here: 10 things you didn't know about Java
#3是他们提到上述语法可被利用的所有方式的地方
#3 is where they make mention of all the ways the above syntax can be exploited
推荐答案
查看全文