Java: cannot figure why code is not logically correct

Printable View