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.


//from  w  ww  .j  ava2s . c  om
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.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable