I’m having a problem with Generic Types in static method. I have this code:
public class BST<E extends Comparable<E>> {
public static class Node<T> {
private T value;
private Node<E> left, right, parent;
private Node(T v) {
value = v;
}
public String toString() {
return value.toString();
}
}
....
}
then i wanna use Node in this static method:
public static <E> boolean equalTrees(Node<E> r1, Node<E> r2)
but at Node is giving me this error:
The member type BST.Node must be qualified with a parameterized type, since it is not static
I’ve searched and can’t find the answer to that.
Try this: