What is NaN?
NaN is a data type which says "Not a Number". An operation between invalid operands result in this type of data. Like an operation of addition between a string and a number.
Why is Java called "write once run anywhere"?
Let us first assume every machine of various OS has their appropriate JVM's (Java Virtual Machine) installed. We write a java code on our machine, then compile it. After compilation we get a bytecode file. This bytecode is interpreted by JVM and give us the output. So we can take this bytecode, put into another machine and its runs and gives us the output. Hence no need of recompiling and running. Hence we say, write once and run anywhere(provided appropriate JVMs are installed in them).
what is a dangling pointer?
First of all a pointer is a variable which holds the address of a memory location which might hold some object. Using the pointer we can access the desired content(or object) at the specified location. If we delete the content the memory gets freed. But still the pointer contains the address which is invalid. Such pointers after deleting the content in the memory they are pointing at are called dangling pointers.