Posted By:
3 Mar, 2014 2:03 pm PST

Convert String to Integer in JAVA

How to convert String to Integer in Java

In Java we can easily convert String to Integer using toString method.

EXAMPLE:

//To convert String to integer.

public class StringConvert{

               public static void main(String args[]){

                               int num = Integer.parseInt("12345");

                               System.out.println("Converted String to          

                               Integer:"+num);

               }

}

 

Output of the above program is:

Converted String to Integer:12345

Attachment:None View Live Demo



Please login to reply to this problem.



Related Problems on Fixoncloud