public class array2{ public static void main(String[] args) { sayHello("beijing","xian"); } private static void sayHello(String ... args) { for (int i = 0; i < args.length; i++) System.out.println("hello," + args[i]+"!"); } }
jdk新特性——可变参数
时间: 2024-10-24 19:22:25