title: unable to parse text using MessageFormat
body: <p>I am attempting to use MessageFormat class to parse a message.  But I get &quot;MessageFormat parse error!&quot;.  I got this code from internet.  Here is the <a href="https://www.geeksforgeeks.org/messageformat-parse-method-in-java-with-example-set-1/" rel="nofollow noreferrer">link</a>:</p>
  <pre><code>package myy.test;
  import java.text.MessageFormat;
  import java.text.ParseException;
  
  public class TestParse {
  
  public static void main(String[] args) {
      // TODO Auto-generated method stub
      try { 
          // creating and initializing  MessageFormat 
          MessageFormat mf 
              = new MessageFormat(&quot;{0, number, #}, {2, number, #.#}, {1, number, #.##}&quot;); 
          ; 
  
          // creating and initializing String source 
          String str = &quot;10.456, 20.325, 30.444&quot;; 
          System.out.println(str); 
          // parsing the string 
          // accoridng to MessageFormat 
          // using parse() method 
          Object[] hash = mf.parse(str); 
  
          // display the result 
          System.out.println(&quot;Parsed value are :&quot;); 
          for (int i = 0; i &lt; hash.length; i++) 
              System.out.println(hash[i]); 
      } 
      catch (ParseException e) { 
          System.out.println(&quot;\nString is Null&quot;); 
          System.out.println(&quot;Exception thrown : &quot; + e); 
      } 
  
  }
  }
  </code></pre>
  <p>I get the following output in the console.</p>
  <pre><code>10.456, 20.325, 30.444
  
  String is Null
  Exception thrown : java.text.ParseException: MessageFormat parse error!
  </code></pre>
  <p>Why do I get this error and how do I resolve it?  Thanks.</p>