标签:
1.import static导入静态方法
import static java.util.Arrays.*;
public class Example {
public static void main(String[] args) {
int[] target = new int[]{5,4,7};
sort(target);
for (int i = 0; i < target.length; i++) {
System.out.println(target[i]);
}
}
}
2.可变参数 Object...
public class Example2 {
public static void speak(String speaker, String... words){
for (int i = 0; i < words.length; i++) {
System.out.println(speaker+":"+words[i]);
}
}
public static void main(String[] args) {
String sentence = "I am a slow walker , but I never walk backwards .";
speak("Lincoln", sentence.split(","));
}
}
标签:
原文地址:http://www.cnblogs.com/barker/p/5162372.html