I just saw this weird piece of code in another question. I thought it would result in a StackOverflowError
being thrown, but it doesn't...
public class Node {
private Object one;
private Object two;
public static Node NIL = new Node(Node.NIL, Node.NIL);
public Node(Object one, Object two) {
this.one = one;
this.two = two;
}
}
I thought it was going to thow an exception, because of the Node.NIL
referencing itself to build.
I can't figure it out why it does not.