Jr Java Developer: find the bug and explain the solution