Menu
Question Index
...

What will be the output of the following program?

public class Pen {
    public static void main(String args[]) {
        Double pen = Math.sqrt(25);
        System.out.println(pen);
        boolean b1 = isNaN(pen);
        System.out.println(b1);
        boolean b = Double.isNaN(pen);
        System.out.print(b);
    }
    static public boolean isNaN(double k) {
        return (k != k);
    }
}


5.0
false
true
5.0
true
false
5.0
false
false
5.0
true
true
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Math Class - java.lang.Math

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App