Trees

Every computer user who uses a hierarchical file system has encountered tree displays such as the one in Figure 6-5. Of course, directories and files form only one of the many examples of treelike organizations. Programmers are familiar with inheritance trees for classes. Many tree structures arise in everyday life, such as the hierarchy of countries, states, and cities shown in Figure 6-6.

Figure 6-5. A directory tree

Figure 6-6. A hierarchy of countries, states, and cities

As programmers, we often have to display these ...

Get Core Java™ 2 Volume II - Advanced Features, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.