Java.lang.Long.toString() Method


Description

The java.lang.Long.toString() method returns a String object representing this Long's value.

Declaration

Following is the declaration for java.lang.Long.toString() method

public String toString()

Parameters

NA

Return Value

This method returns a string representation of the value of this object in base 10.

Exception

NA

Example

The following example shows the usage of java.lang.Long.toString() method.

package com.tutorialspoint;

import java.lang.*;

public class LongDemo {

   public static void main(String[] args) {

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

Let us compile and run the above program, this will produce the following result −

Value = 65079
java_lang_long.htm
Advertisements