In this video, we will see how we can convert a string into an integer. As we all know the String in is a sequence of characters, for example Hello is a string of 5 characters. In java, a string is an immutable object which means it is constant and can not be changed once it has been created. And integer is a data type in Java. One point to note here is if you want to manipulate a string made up of digits like one two three, you need to convert to an integer value for any further arithmetic operations.
So how can we convert a string into integer in Java ? There a two ways in which you can convert the string to int in Java.
1. Integer.parseInt(String) method
2. Integer.valueOf(String) method
Refer to the linked video for more detailed and live demonstration of conversion of string to integer in Java.