Just noticed in ByteArrayOutputStream
, the toByteArray()
is declared as,
public synchronized byte toByteArray()[];
What's the difference between this declaration and the following one?
public synchronized byte[] toByteArray();
In this case, none.
If you had declarations:
byte[] a, b;
byte c[], d;
then a
, b
, and c
are byte[]
, and d
is byte
.
没什么区别,尽管程序员之间的约定非常喜欢后者。
Java coding conventions document recommends the second variant (byte[] b). See example .
顺便说一句,对于多维数组,您还可以混合使用两种方法:
public synchronized byte[] to2DByteArray()[];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.