package test;
import demon.Person;
class Tuple<A, B> {
public final A first;
public final B second;
public Tuple(A a, B b) {
first = a;
second = b;
}
public String toString() {
return "(" + first + "," + second + ")";
}
public A getFirst() {
return first;
}
public B getSecond() {
return second;
}
}
public class Test006 {
public static void main(String[] args) {
Tuple<Person, Integer> t = new Tuple<>(new Person("zhangsan"), 12);
System.out.println(t.getFirst().getName());
System.out.println(t.getSecond());
}
}
转载于:https://www.cnblogs.com/kukai/p/11247202.html