Beginner code that I've written in Java