Java?п??????????ü????????
???????????? ???????[ 2013/7/25 10:18:52 ] ????????
??????Java5 ?????????????varargs?????????????????п?????????????????????????????????????ò????????????????????print("hello");print("hello"??"lisi");print("hello"??"????"?? "alexia");?????????ζ????????? ?????????????????
????1. ????????????
???????...????????????????
print(String... args){
...
}
????????п????????????п???????????????????????????????????е???????
print(String... args){
for(String temp:args)
System.out.println(temp);
}
????2. ?????????????????
???????????????????????????????????????????磺
print();
print("hello");
print("hello"??"lisi");
print("hello"??"????"?? "alexia")
????3. ???????????ù???
????3.1 ????÷???????????????????????????????????????????????????????????????????????????????????
package com;
// ???????????????
import static java.lang.System.out;
public class VarArgsTest {
public void print(String... args) {
for (int i = 0; i < args.length; i++) {
out.println(args[i]);
}
}
public void print(String test) {
out.println("----------");
}
public static void main(String[] args) {
VarArgsTest test = new VarArgsTest();
test.print("hello");
test.print("hello"?? "alexia");
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11