The output is Nan, what does is it mean ?

+14 votes

The NaN property means a "Not-a-Number" value. This property tells us that a value is not a legal number.

When there is an operation to produce some undefined result,Nan is produced. For example, any number divided by 0.0 is arithmetically undefined.Also, the square root of a negative number is also undefined in maths, so it is Nan.

According to IEEE 754, there are two types of NaN: quiet and signaling.

+2 votes

"NaN" stands for "not a number".

"Nan" is created if a computer operation has input parameters that generate the procedure to create some indefinable result.

**Get a detailed understanding of Java from scratch! Refer to this video provided by Intellipaat:**

For example, 0.0 divided by zero.0 is arithmetically indefinable.

Taking the root of a negative number is also indefinable.