Java Data Type Tutorial - Java Long.valueOf(String s)








Syntax

Long.valueOf(String s) has the following syntax.

public static Long valueOf(String s)   throws NumberFormatException

Example

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


public class Main {

   public static void main(String[] args) {

     String str = "1234567890987654";
     System.out.println("Value = " + Long.valueOf(str));
   }
}

The code above generates the following result.