티스토리 뷰

The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double. In addition, this class provides several methods for converting a double to a String and a String to a double, as well as other constants and methods useful when dealing with a double.

 

1. double 형 숫자를 String으로 변환

 

String strTemp = Double.toString(1.23456);

 

The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class. Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings. Because String objects are immutable they can be shared. For example:

 

2. String형 숫자를 double형으로 변환

 

double dTemp = Double.parseDouble("1.23456");