Javatpoint Logo
Javatpoint Logo

Java long to String

We can convert long to String in java using String.valueOf() and Long.toString() methods.

Java Convert long to String

Scenario

It is generally used if we have to display long number in textfield in GUI application because everything is displayed as a string in form.


1) String.valueOf()

The String.valueOf() is an overloaded method. It can be used to convert long to String. The valueOf() is the static method of String class. The signature of valueOf() method is given below:

Java long to String Example using String.valueOf()

Let's see the simple code to convert long to String in java.

Let's see the simple example of converting long to String in java.

Test it Now

Output:

9993939399

2) Long.toString()

The Long.toString() method converts long to String. The toString() is the static method of Long class. The signature of toString() method is given below:

Java long to String Example using Long.toString()

Let's see the simple code to convert long to String in java using Long.toString() method.

Let's see the simple example of converting long to String in java.

Test it Now

Output:

9993939399





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA