String to double and double to string in java

String to Double and Double to String in Java:

Program:

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);

	}

}

Output:

String to Double 3566.34
Double to String 38472.34923

 

 

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

322 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *