Sample code from an Introduction to Java class.
To work with the files in NetBeans, simply download the ZIP, and then import the project with "File -> Import Project -> From ZIP...".
Note: Some of the code in these files require the use of Java 8 or later.