Java exercises and code snippets