Convert String to Integer and Integer to String in Java vice versa


To convert Integer into String in Java, we can use toString() method in Integer class instance :

1
2
Integer hello = 1;
String convert = Integer.toString(hello);

Then, to convert String into Integer, we can use parseInt() method in Integer class instance:

1
2
String hello = "1";
Integer convert = Integer.parseInt(hello);

Easy! 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.