Share on Google+Share on Google+

Convert Double To String

Advertisement
This is a simple program based on the package java.lang. This section learns you the conversion of double into string.

Convert Double To String

     

This is a simple program based on the package java.lang.  This section learns you the conversion of double into string. The following program implements the method toString().

Code Description:  

The program  takes a variable of double type and convert it into the string form by using toString() method. Here, first of all define class name "DoubleToString" for java component. The following program facilitates you for converting the double type variable into string by using toString() method.

Here is the code of this program:

public class  DoubleToString{
  public static void main(String[] args) {
  double d = 100.0;
  String str = Double.toString(d);
  System.out.println("string:=" + str);
  }
}

 Download this program:

Output this program.

 C:\corejava>java DoubleToString
string:=100.0
C:\corejava>

Advertisements

Advertisement

Posted on: July 3, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Convert Double To String   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0