Basic java puzzles