Using double Data Type

Practise your skills and try to change the code. Read the comments and try what is within the TODO comment.

class DoubleDemo {
    public static void main (String[] args) {
        //A double type holds a floating point number
        //A double is a 64-bit precision floating point number
        //Use double type for high precesion floating point types
        double averageScore = 550.50; 
        System.out.println("averageScore " + averageScore);

        //We can also prefix it with a D or d but a floating point literal is automatically a double value
        double totalScore = 975.05D;
        System.out.println("totalScore " + totalScore);


        //We can also use scientifc notifcation to represent the double value
        double minimumDoubleValue = 4.9E-324;
        double maximumDoubleValue = 1.7976931348623157E308;
        System.out.println("minimumDoubleValue " + minimumDoubleValue);

        //TODO
        //Change the value of totalScore and use the small d instead of the D and Run again
        //Notice we can either use a d or D or leave the prefix out
        //Create a variable called height and assign it your double height value
        //Print the height to the console
    }
}
  

results matching ""

    No results matching ""