Science, asked by OmBirari7824, 1 year ago

Why operator overloading is not available in Java?

Answers

Answered by theaandthurdi
0

Java does not support operator overloading by programmers. This is not the same as stating that Java does not need operator overloading. ... This declaration can be found in the Java Language Environment whitepaper: There are no means provided by which programmers can overload the standard arithmetic operators.

Answered by AgarwalSahb
1

Unlike C++, Java doesn't support operator overloading. Java doesn't provide freedom to programmer, to overload the standard arithmetic operators e.g. +, -, * and / etc. If you have worked previously in C++, than you know that, Java has left lot of feature supported in C++ e.g.  Java doesn't support multiple inheritance, no pointers in Java, and no pass by reference in Java. Rarely this question asked in Java interviews, to check how programmer thinks about certain features, which is not supported in Java. Another similar questions is regarding Java being pass by reference, which is mostly appear as, whether Java is pass by value or reference. Though I don't know the real reason behind it, I think following observation make sense on, why Operator overloading is not supported in Java.

Similar questions