Javatpoint Logo
Javatpoint Logo

Java String to long

We can convert String to long in java using Long.parseLong() method.

Java Convert String to long


It is generally used if we have to perform mathematical operations on the string that contains long number. Whenever we get data from textfield or textarea, entered data is received as a string. If entered data is long, we need to convert string to long. To do so, we use Long.parseLong() method.


The parseLong() is the static method of Long class. The signature of parseLong() method is given below:

Java String to long Example

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

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

Test it Now



Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA