开发者

Var-arg syntax in Java

开发者 https://www.devze.com 2023-02-27 00:28 出处:网络
private void setUuid开发者_如何学C(int.. uuid) { // method stuff } The Java 6 compiler complains when I try to use the syntax above .. Isn\'t the var-arg above valid ? According to the 1.5 language
private void setUuid开发者_如何学C(int.. uuid)  
{
  // method stuff
}  

The Java 6 compiler complains when I try to use the syntax above .. Isn't the var-arg above valid ?


According to the 1.5 language docs it's three periods:

private void setUuid(int... uuid)  
{
  // method stuff
}


You need three dots to make an argument a vararg.

0

精彩评论

暂无评论...
验证码 换一张
取 消