Java - String valueOf() Method
The Java string valueOf() method returns the string representation of the long argument.
Syntax
public static String valueOf(long l)
Parameters
l |
specify a long. |
Return Value
Returns a string representation of the long argument.
Exception
NA.
Example:
In the example below, valueOf() method returns the string representation of the given argument.
import java.lang.*; public class MyClass { public static void main(String[] args) { long x1 = 1254; System.out.println(String.valueOf(x1)); long x2 = -1254; System.out.println(String.valueOf(x2)); } }
The output of the above code will be:
1254 -1254
❮ Java.lang - String