文章浏览阅读355次。首先创建3个类:1、Foo类,用于打印变量public class Foo { public Foo(String word) { System.out.println(word); }}2、Parent类public class Parent { static Foo FOO = new Foo("Parent's_java中静态代码块先执行还是静态成员变量......
java提供了可变参数的方法,即方法的参数个数可以不确定,用"..."定义。import java.util.ArrayList;import java.util.List;public class VariableParameter { //求若干个整型数中的最大值 public int getMax(int... items){ //定义可变参数item...