Java Data Type Tutorial - Java Long(String s) Constructor








Syntax

Long(String s) constructor from Long has the following syntax.

public Long(String s)  throws NumberFormatException

Example

In the following code shows how to use Long.Long(String s) constructor.

public class Main {
  public static void main(String[] args) {
    Long long2 = new Long("12346");
    
    System.out.println(long2);
  }
}

The output: