Problems and solutions in Java