If someNumber is a short variable with a value of -25, which one of the answers below is true of attempting to compile and execute the following statement: System.out.println("Root= " + Math.sqrt(someNumber));
Option:-
1. the statement will not compile
2. the statement will display "Root=NaN"
3. the statement will display "Root= 5.0"
4. the statement will display "Root= -5.0"
•Spammers are to maintain social distancing
Answers
Answered by
2
Answer:
Option 2: the statement will display "Root=NaN"
Explanation:
The square root of negative number is not possible...Hence the control will compile but it will display Root=NaN.
Answered by
3
Answer:
The statement will display "Root= NaN"
Explanation:
As square root of a negative number cannot be determined so, Math.sqrt( ) returns NaN short for Not a Number.
Similar questions