Tricky java programs