Why operator overloading is not used in java??

Java only allows arithmetic operations on elementary numeric types. It's a mixed blessing because although it's convenient to define operators on other types (like complex numbers, vectors etc), there are always implementation-dependent idiosyncrasies. So operators don't always do what you expect them to do. By avoiding operator overloading, it's more transparent which function is called when. A wise design move in some people's eyes.


Comments