MessageFormat parse() method in Java with Example : Set – 1
The parse() method of java.text.MessageFormat class is used to parse the string object from the beginning of the index.
public Object parse(String source) throws ParseException
Parameter: This method takes string source as an argument over which parsing is going to take place.
Return Value: This method returns array of object as an output.
Exception: This method throws ParseException if the beginning of the specified string can not be parsed.
Below are the examples to illustrate the parse() method:
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.
Parsed value are : 10.456 30.444 20.325
String is Null Exception thrown : java.text.ParseException: MessageFormat parse error!