How to Convert Double Object to String Object

/*
 * Here we will learn to convert Double object to String Object
 */
public class ConvertDoubleObjToStringObj {

	public static void main(String[] args) {

		/**
		 * Below constructor with string argument will constructs a newly
		 * allocated Double object that represents the floating-point value of
		 * type double represented by the string. The string is converted to a
		 * double value as if by the valueOf method.
		 */
		Double doubleObj = new Double("102012");

		/**
		 * Double Class overrides the toString method from Object class which
		 * returns a string representation of this Double object.
		 */

		String doubleToString = doubleObj.toString();
		System.out.println("Value of converted String :"+doubleToString);

	}
}

 

By | 2017-07-24T12:44:47+00:00 October 1st, 2012|Code Base|1 Comment

About the Author:

One Comment

  1. sengu March 11, 2015 at 7:48 am - Reply

    Nice Tutorial

Leave A Comment