Wednesday 29 October 2014

String to Integer Conversion in Java

Structure of the Problem Requirements 

In this problem we will learn how to convert a string into integer. Just like String the Integer has many builtin functions which used for different purpose and  one of them is parseint which is used to convert a string into integer. Here is the source code of this problem which help you in better understanding.

Source Code


public class Conversion    
{
public static void main(String[] args)
{
System.out.println("\t \t \t LEP Tutorials \n ");
String str = "366";
System.out.println(" The Value of String is : " + str);
int num = Integer.parseInt(str);
System.out.println(" The Value of Number is : " + num);
}
}

Output of the program

String to Integer Conversion in Java
String to Integer Conversion in Java

Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment