Java.lang.Long.toString(long i) Method


Advertisements


Description

The java.lang.Long.toString(long i) method returns a String object representing the specified long i.

Declaration

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

public static String toString(long i)

Parameters

  • i -- This is a long to be converted.

Return Value

This method returns a string representation of the argument 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(5);
   
   // returns a string representation of the specified long in base 10
   String retval = l.toString(76730);
   System.out.println("Value = " + retval);
   }
}  

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

Value = 76730

java_lang_long.htm

Advertisements