Examples from http://docs.oracle.com/javase/tutorial