Menu
Question Index
...

What will be the output of the following program?

public class Sample2 {
    public static void main(String[] args) {
        double d = Double.POSITIVE_INFINITY;
        System.out.print(d + " # ");
        double d3 = Double.NEGATIVE_INFINITY;
        System.out.print(d3 + " # " + (d == d3) + " # ");
    }
}


Infinity # -Infinity # true #
Infinity # -Infinity # false #
Infinity # Infinity # false #
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Double Class And Java Float Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App