又一次被Java的函数传参搞死...写段代码,纪念下...
package jie.java.test;
public class main {
public static class Holder<T> {
private T value = null;
public Holder(T value) {
this.setValue(value);
}
public T getValue() {
return value;
}
public void setValue(T value) {
this.value = value;
}
}
private static void paramTest(Integer in, Holder<Integer> o) {
// o = new Holder<Integer>(100);
o.setValue(in);
}
public static void main(String[] args) {
Integer i = 10;
Holder<Integer> o = new Holder<Integer>(0);
paramTest(i, o);
System.out.println("o = " + o.getValue());
}
}