Example & Tutorial understanding programming in easy ways.

Why Java does not support operator overloading ?

Java doesn't support operator overloading. Java doesn't provide freedom to programmer, to overload the standard arithmetic operators e.g. +, -, * and / etc.
e.g. Java doesn't support multiple inheritance, no pointers in Java, and no pass by reference in Java.

Following points describe for this Raeson:
1 Simplicity and Cleanliness
Simple and clear design was one of the goals of Java designers. They, just don't want to replicate the language, but wanted to have a clear, truly object oriented language. Adding Operator overloading would have definitely made design more complex than without it, and it might have lead to more complex compiler or slows the JVM.
2 Avoid Programming Errors
Java doesn't allow user defined operator overloading, because if you allow programmer to do operator overloading, they will come up with multiple meanings for same operator, which will make the learning curve of any developer hard and things more confusing.
3 JVM Complexity
From JVM perspective, supporting operator overloading is more difficult, and if the same thing can be achieved, by using method overloading in more intuitive and clean way, it does make sense to not support operator overloading in Java.
4 Easy Development of Tools
This is an additional benefit of not supporting operator overloading in Java. Omission of operator overloading has kept the language easier to handle and process, which in turn makes it easier to develop the tools, that process the language e.g. IDE or re-factoring tool. Re-factoring tools in Java are far better than C++.
  

Read More →