Improved Java examples