java reference knowledge, tree traversal