Home >Java >javaTutorial >Ellipsis in Java

Ellipsis in Java

巴扎黑
巴扎黑Original
2016-12-20 14:47:472557browse

public static void test(int... args){
if(args!=null){
System.out.println(args);
System.out.println(args.length);
}else{
System.out.println("null");
}
}
public static void main(String[] args) {
test();
test(1,2,3);
}
输出:
[I@a90653
0
[I@de6ced
3
其实这个是J2SE 1.5提供的“Varargs”机制
具体的可以参考
[url]http://blog.csdn.net/avius/archive/2004/08/05/65970.aspx[/url]

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn