Annotated Java Code Samples

This website provides Java code samples with additional documentation that can be provided on-demand through pop-ups and dialogs. Current code samples are on essential concepts of Java and the collection from the book Introduction to Software Design with Java, 2nd Edition. Additional samples will be added over time.

Code samples on the basic features of Java necessary to get started with programming.

Sample program that outputs the text of the poem "The Twelve Days of Christmas" to the console.

Code samples focused on illustrating how to decompose a system into distinct, manageable abstractions.

Code samples that illustrate best practice for organizing code effectively using types and interfaces.

Code samples that clarify what object state is and how we can manage it in a principled way.

Code samples on metaprogramming with reflection and unit testing with JUnit.

Code samples showing how to build functionality by composing objects.

Code samples showing how inheritance works and how to use it properly.

Code samples showing different applications of inversion of control, through the Observer and Visitor design patterns.

Code samples about functional-style programming in Java.