Double? ceshidouble? =? 2 1.23;
String? Lin Qiu River? =? "34.343434";
ceshidouble? =? Double.valueOf (Lin Qiu River. tostring());); //For conversion, if the string itself is other words, an exception will be thrown and need to be handled. The following code will generate an exception and cannot be converted.
Double? ceshidouble2 = 223.23
String? Lin Qiu 2="34. Test conversion error "; Double in Java can also be converted into string type, and the code is as follows:
Public? Static electricity Invalid? main(String[]? args)? {
Double? s = 123456789.50;
Decimal format? Format? =? New? decimal format(" # . 00 ");
String? Smony? =? Format. Format; //Format and convert double to string.
system . out . println(s money);
} String type As long as the string itself belongs to the converted type, such as int type, double type and long type, it can be successfully converted, and the conversion may fail, so you should catch the exception.