您的位置:首页 > 编程语言 > Java开发

java 不定参数使用示例

2010-01-11 15:48 288 查看
public class javaTest {
public static void test(String ...strings){
for(String str: strings){
System.out.print(str + " ");
}
System.out.println();
}

public static void main(String[] args){
test("a", "b", "c", "ddd");
test("a");
test("aaa", "aaadfd");
}
}


输出结果

a b c ddd

a

aaa aaadfd
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: