double to String Conversion

String str = String.valueOf( age )

OR

String str = String.format("%f",age)

import java.util.Scanner;


public class TestProgram
{
   
    public static void main() {
        
        Scanner in = new Scanner(System.in);
		String str;
		double age;
		
		System.out.print("How old are you? ");
		age = in.nextDouble();
		in.nextLine();       //consume the newline left over
		
		str = String.valueOf(age);  //even better  str = String.format("%f",age);
		
		System.out.printf("You are %s years old\n", str);
    }
}