public class StringtoInt{
public static void main(String[] args) {
// TODO Auto-generated method stub
//int to string
//String to integer
String abc="This is a string";
System.out.println(abc);
Byte xyz=10;
Byte.toString(xyz);
int x=100,y=200;
String z=Integer.toString(x);//Int to String conversion
String l=Integer.toString(y);
System.out.println(z+l);
int a=Integer.parseInt(z);//String to Int conversion
int b=Integer.parseInt(l);
System.out.println(a+b);
}
}
output is
100200
300
In the above program we convert int to string with toString method and then again convert string to int with parseInt method.
>>>------------------------------------------------------------------------------------------------------------