Java classic questions