Java code snippets written for learning