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[];
Edit: 2018-05-22
I found even more uses of this crazy syntax here: 10 things you didn't know about Java
#3 is where they make mention of all the ways the above syntax can be exploited