Examples from java book