Java example of code 8.7