29/10/2014

String to Integer Conversion in Java

Just like String the Integer has many builtin functions that are used for different purpose and one of them is parseint which is used to convert a string into integer.

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

No comments:

Post a Comment