String to double and double to string in java

String to Double and Double to String in Java:

Program:

[java]
package com.tutorialspoint;

public class StringToDouble {

public static void main(String[] args) {
String value = "3566.34";
double valueInDouble = Double.parseDouble(value);
System.out.println("String to Double "+valueInDouble);

double input = 38472.34923;
String inputInString = Double.toString(input);
System.out.println("Double to String "+inputInString);

}

}
[/java]

Output:

String to Double 3566.34
Double to String 38472.34923

 

 

Thanks for reading this post……….!!!

Leave a Reply