java based coding exercise