Print Double Variable

This program prints the value of a double variable to the console.

Problem Statement

Write a Java program that declares a double variable and prints its value.

Source Code

1 public class PrintDouble {
2 public static void main(String[] args) {
3 double pi = 3.14159;
4 System.out.println("The value of pi is: " + pi + " - Eduinq");
5 }
6 }

Program Output

The value of pi is: 3.14159 - Eduinq

Explanation

A double variable pi is declared and assigned the value 3.14159. It is concatenated with text and printed, showing how floating point values can be displayed with text output.

Quick Links to Explore