int -> string
int a = 1;
String b = String.valueOf(a);
System.out.println(b);
string -> int
try {
//string -> int
String a1 = "1a";
int b1 = Integer.parseInt(a1);
System.out.println(b1);
} catch (Exception e) {
System.out.println(e);
}
/**
result :java.lang.NumberFormatException: For input string: "1a"
*/
try {
//string -> int
String a1 = "1a";
int b1 = Integer.parseInt(a1);
System.out.println(b1);
} catch (NumberFormatException e) {
System.out.println(e);
} finally {
System.out.println(112222);
}
/**
result :
java.lang.NumberFormatException: For input string: "1a"
112222
*/