O'Reilly logo

PURE Java™ 2 by Kenneth Litwak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Class Details

Class ChoiceFormat

public class
							ChoiceFormat
                 extends NumberFormat

The ChoiceFormat class is useful for formatting a range of numbers. It is often used in a MessageFormat for dealing with plurals. The choices are specified with a list of doubles in ascending order. The ChoiceFormat class differs from the other formatting classes in this package because it requires the use of a constructor, rather than a factory method, such as getInstance(). A ChoiceFormat is specified with two formats: limits and values. Here's a short code snippet that you could make part of a program:

 double[] limitArray = { 1,2,3,4,5,6}; String[] formatArray ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required