To answer this question, let's go through each option to understand why it is correct or incorrect:
Option A) Prints: false,false,false - This option is incorrect because it does not match the expected output.
Option B) Prints: false,true,false - This option is incorrect because it does not match the expected output.
Option C) Prints: true,false,false - This option is incorrect because it does not match the expected output.
Option D) Prints: true,true,false - This option is incorrect because it does not match the expected output.
Option E) Prints: true,true,true - This option is correct because it matches the expected output.
The correct answer is Option E. This option is correct because the method m(double v)
returns true
when the input is Double.NaN
(not-a-number) and true
when the input is Double.POSITIVE_INFINITY
(positive infinity). Therefore, when d1
is Double.NaN
, m(d1)
returns true
. Similarly, when d2
is Double.POSITIVE_INFINITY
, m(d2)
returns true
. However, when d3
is Double.MAX_VALUE
, m(d3)
returns false
because Double.MAX_VALUE
is a finite value and not equal to Double.NaN
or Double.POSITIVE_INFINITY
.
Thus, the program will print: true,true,true.