This is related to Declaring an instance of a class inside that class
Why the static inner class Node allows the new Node[R] field within the class, and why the infinite recursion is not happening here?
public class TrieST<Value> {
private static final int R = 256; // extended ASCII
private Node root; // root of trie
private int N; // number of keys in trie
// R-way trie node
private static class Node {
private Object val;
private Node[] next = new Node[R];
}
...
}
x = new Node(); // is fine within the containing class, but new Node[R] inside static nested Node class is not clear.
new Node[]just initializes the array. It doesn't createRNode objects.new Node[R]. I the reason is it's being static then why the construction is allowed via new?