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