The first example shows an iterative and a recursive version of a factorial function. Static functions roughly correspond to ordinary functions in other languages. The next example shows a linked-list based stack class with an auxiliary node class. Nodes removed from the stack are garbage-collected eventually by system. Instance variables such as topNode are initialized to the null object.
Packages are groups of related classes.
An undergraduate course in object-oriented programming in the second year would offer an adequate context for introducing Java. This allows some amount of separation between interface and implementation hierarchies. Networking Advanced, specialized undergraduate courses can similarly benefit from using Java. In a networking course, various predefined socket and URL classes facilitate writing network clients and servers. Java supports concurrency and provides facilities for communication and synchronization of threads.