I know that '==' operator checks for if they exists in the same memory location in Java, but why, whrn I am comparing char
and double
data types, Java is giving me true
? Are they not different data types? And why it is not giving me a compile-time error, because according to the docs:
If we apply == for object types then, there should be compatibility between arguments types (either child to parent or parent to child or same type). Otherwise, we will get a compile-time error.