package com.test;
public class test1{
static void Fun(String[] strings ){
String[] strs = strings;
for (String string : strs) {
System.out.println(string);
}
}
static void fun(String...strings){
String[] strs = strings;
for (String string : strs) {
System.out.println(string);
}
}
public static void main(String[] args){
System.out.println("-----------String...----------------");
fun("1","2","3");
fun(new String[]{"1","2","3"});
System.out.println("-----------String[]----------------");
Fun(new String[]{"1","2","3"});
}
}
java中如何接受不定参数
最新推荐文章于 2024-07-16 05:23:10 发布