Okay so in class my professor was going over this code:
class BinaryTreeNode<T> {
protected T element;
protected BinaryTreeNode <T> left, right;
BinaryTreeNode (T obj) {
element = obj;
left = null;
right = null;
} // constructor BinaryTreeNode
public int numChildren() {
int children = 0;
if (left != null)
children = 1 + left.numChildren();
if (right != null)
children = children + 1 + right.numChildren();
return children;
}
}
I followed everything about the different kind of traversal sequences. And the code makes since but why is there <T> after the Class at the beginning. I know the<> declares of what type. But I couldn't find on google a type T? Any help?