public class Test<T> {
public static void main(String[] args) throws IOException {
Test<String> t = new Test<String>();
Test<Integer> t2 = new Test<Integer>();
}
public void ichErwarteT(T o){
//mache was mit T...
}
}
class Tree<T> {
private T value = null;
private Tree<T> left = null
private Tree<T> right = null
public Tree<T>(T value) {
this.value = value;
}
public void setLeft(Tree<T> left) {
this.left = left;
}
public void setRight(Tree<T> right) {
this.right = right;
}
public boolean contains(T t) {
return t.equals(value) || (left != null && left.contains(t)) || (right != null && right.contains(t));
}
...
}
public static <T extends Comparable<T>> T max(T t1, T t2) {
return (t1.compareTo(t2) >= 0) ? t1 : t2;
}