Varargs was added in Java 5 and the syntax includes three dots … (also called ellipses)

Following is the syntax of vararg method.

public void testVar(int count, String... vargs) { }

String.. .   actualy is a list of String.

You may use for(String s : vargs) to iterate through it.

Mainly used in Reflection API, when you do not know exactly how many parameters of a method has.

posted on 2009-11-24 21:30 simplelove 阅读(297) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2009年11月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜