+ 7

# Please give some examples when we can encounter NaN in java

e. g. 0/0

5 Answers

+ 22

Math.log(-5)

+ 21

Math.sqrt(-5)

+ 18

4/0
NaN stands for Not a Number //

+ 7

Thanks anubhav but cpp and java may have different rules for NaN

+ 6

@Dayve Actually i know nan means not a number and i also know one example division by zero but can you please provide some more examples