|
|
Submitted by Rahimv on Sat, 08/28/2010 - 22:49
/*
* Convert String to Double example. Program to convert Java
* String object to Double object.
*/
public class StringToDouble {
public static void main(String args[]){
//new String object
String str = new String("16.85");
//Use Double(String) constructor
Double dObj1 = new Double(str);
|
|
|
Submitted by Rahimv on Sat, 08/28/2010 - 22:49
/*
* Convert Double to String example. Program to convert Java
* Double object to String object.
*/
public class DoubleToString {
public static void main(String args[]){
//new Double object
Double dObj = new Double("1.543");
//to convert Double to String use toString method of Double wrapper class
String strDValue = dObj.toString();
|
|
|
Submitted by Rahimv on Sat, 08/28/2010 - 22:48
/*
* Convert double primitive to Double Object example. Program to convert Java
* double primitive data type to Double object.
*/
public class DoublePrimitiveToDouble {
public static void main(String args[]){
//new double primitive
double d = 5.74;
//Use Double(double d) constructor
Double dObj1 = new Double(d);
|
|