The Pi4J project includes many more comprehensive examples included both when installed locally and available in the Pi4J Exmaples project at GitHub.
The Pi4J Examples project can be found on GitHub at this location: https://github.com/Pi4J/pi4j/tree/master/pi4j-example/src/main/java
When Pi4J is installed using the Debian package installer, Pi4J will also include all examples in the "/opt/pi4j/examples" path on your local file system.
If you have not already downloaded and installed the Pi4J library on the RaspberryPi, then view this page for instructions on where to download and how to install Pi4J:
Download & Install Pi4J
Next, use the following command to compile any of the example programs:
javac -classpath .:classes:/opt/pi4j/lib/'*' -d . __ExampleName__.java
sudo pi4j --compile __ExampleName__.java