public class Varargs
{
	public static void main(String[] args)
	{
		test(3,"java","C++","PHP");
	}
	
	public static void test(int num,String... books)
	{
		System.out.println(num);
		for(String book : books)
		{
			System.out.println(book);
		}
	}
}

运行结果:

 

版权声明:本文为lixiaolun原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/lixiaolun/p/4311880.html