Showing posts with label How to convert String into integer in Java. Show all posts
Showing posts with label How to convert String into integer in Java. Show all posts

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