Java Data Type Tutorial - Java Long.toString()








Syntax

Long.toString() has the following syntax.

public String toString()

Example

In the following code shows how to use Long.toString() method.

public class Main {
//  w  ww  .  j  av  a  2 s .c  om
   public static void main(String[] args) {

     Long l = new Long(1234567890);
   
     // returns a string representation of the long value in base 10
     String retval = l.toString();
     System.out.println("Value = " + retval);
   }
}

The code above generates the following result.