ChoiceFormat parse() method in Java with Examples
The parse() method of java.text.ChoiceFormat class is used to get the limit value for particular format in ChoiceFormat object.
public Number parse(String text, ParsePosition status)
Parameter: This method takes the following parameters:
- text: which is the text for which limit value have to be found in String format.
- status: which is the index at the which that choice item is present for which limit value to be found.
Return Value: This method returns an array of the specified type which is the format attached to the ChoiceFormat object.
Exception: This method throws NullPointerException if string text or status is null.
Below are the examples to illustrate the parse() method:
String is Null Exception thrown: java.lang.NullPointerException
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.