In this section, we are going to convert numeric type string data into long. The following program provides a functionality to convert a string data (integer) into a long type data.
Code Description:
This program helps you in converting a string type data into a long. Here, define a class named "StringToLong" for java component. Program takes an integer type data as a string format at the console. And transformed into a long type data using the parseLong() method.
parseLong():
This method is used to convert a string into a long.
Here is the code of this program:
import java.io.*;
|
Output this program.
| C:\corejava>java StringToLong Enter the any string number: 50 long:= 50 C:\corejava> |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Convert String To Long View All Comments
Post your Comment