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新特性——可变参数
时间: 2025-01-04 10:41:53