public static void main( String[] args ) { func(new String[]{null}); } public static void func(String...args) { System.out.println("arg length = "+args.length); }
运行结果1
public static void main( String[] args ) { func((String)null); } public static void func(String...args) { System.out.println("arg length = "+args.length); }
运行结果1
public static void main( String[] args ) { func(null); } public static void func(String...args) { System.out.println("arg length = "+args.length); }
报错
public static void main( String[] args ) { func(null,null); } public static void func(String...args) { System.out.println("arg length = "+args.length); }
运行结果为2