Java Format - Java NumberFormat.parse(String source)








Syntax

NumberFormat.parse(String source) has the following syntax.

public Number parse(String source)  throws ParseException

Example

In the following code shows how to use NumberFormat.parse(String source) method.

import java.text.NumberFormat;

public class Main {
  public static void main(String[] args) throws Exception {
    NumberFormat numberFormat = NumberFormat.getNumberInstance();
    System.out.println(numberFormat.parse("123"));
  }
}

The code above generates the following result.