(1) Converting numbers to strings
int i = 7;
Double d = 13.56;
String str1,str2;
STR1 = integer.tostring (i);
STR2 = double.tostring (d);
After execution, the str1 stored string is "7" and the STR2 string is "13.56".
(2) Converting a string to a numeric value
String str1 = "3532";
String str2 = "187.863";
Integer m;
Double N;
m = integer.valueof (STR1); Converts a string type to an integer type
n = integer.valueof (str2); Converts a string type to a double type
int i = M.intvalue (); Converts an integer type to an int type
Double d = n.doublevalue ();
After execution, the integer variable i is 3532, and the floating-point variable is 187.863
(3) The 2nd way to convert from a string to a numeric value
String str1 = "3532";
String str2 = "187.863";
int i = Integer.praseint (STR1);
Double d = double.prasedouble (STR2);
After execution, the integer variable i is 3532, and the floating-point variable D is 187.863
(4) Date type conversion
Converts a string to a date type
Import Java.sql.Date;
Date date = new Date (0);
Date.valueof ("1983-09-09");
Converts a date type to a string type
Import Java.sql.Date;
Date date = new Date (0);
Date.valueof ("1983-09-09"). ToString ();
(5) int turns into integer
int i = 0;
Integer temp = new Integer (i);