Integer.parseInt method for converting string to a number.

writing4angels By writing4angels, 26th Nov 2010 | Follow this author | RSS Feed | Short URL
Posted in Wikinut>Guides>Technology>Computer Software

Java method that is used for converting a string to a number. It is an easy method for quick use in programming.

Integer.parseInt method for converting string to a number.

Java programming offers different methods for conversion between data types. For converting a numerical string to an integer java offers Integer.parseInt method. Have a look at the example below:

class ConvertString


public static void main(String args)


String x=”12″;

int i=Integer.parseInt(x);



As shown in the example above x is a string in the form of number and to be used for calculations and other purpose needs to be converted to an integer data type. Integer.parseInt method converts string to number. By default, java accepts command line argument also in the form of string and so it becomes necessary to find a method that can convert a string to integer, Integer.parseInt is such method.


Integerparseint, Java, Java Script, Java-Deprived, Javascript, Programmable Thermostats, Programming, Programming In C, Programming Software, Programs, Progressive

Meet the author

author avatar writing4angels
A real lover of literature and I appreciate good works of other fellow writers who have given priceless contribution to the content on Internet.

Share this page

moderator johnnydod moderated this page.
If you have any complaints about this content, please let us know


Add a comment
Can't login?