In this section, we will learn how to convert String to long. The following program provides you the functionality to convert String to long.
In this program we have taken a String as "String s = 20000" as shown below. To convert this String to long we have used "parseLong()" method in a try and catch block to catch the exception if occurs. Therefore we get the following output of the program as shown below.
Here is the code of the program:
Output of the program:
long l = 20000
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: April 17, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles