Simple problems in Java