0 =〉 no apples 1 =〉 an apple 2 =〉 apples 下面这个例子更复杂一些:
less than 0 =〉 freezing less than 10 =〉 chilly less than 30 =〉 nice greater than 30 =〉 too hot greater than 100 =〉 boiling 写代码时一种解决方案是使用“if…else”语句,还有一种解决方案是使用“switch-case”语句。但事实上还有一种最简单的方法,尽管很少有人去用它,那就是使用java.text.ChoiceFormat类。