from Think Java p.137