added work through explanation with java