Test and trial code snippets for Java