What is the difference between operator overloading and operator overriding?
Are they the same in inheritance and console program?
Operator overloading and overriding are not supported in Java.
Check following desc quoted from : http://java.sun.com/docs/white/langenv/Simple.doc2.html
2.2.7 No More Operator Overloading
There are no means provided by which programmers can overload the standard arithmetic operators. Once again, the effects of operator overloading can be just as easily achieved by declaring a class, appropriate instance variables, and appropriate methods to manipulate those variables. Eliminating operator overloading leads to great simplification of code.
You cannot override (nor overload) operators in Java.
In some other languages you can, and difference between operator overloading and overriding is the same like between function overloading and overriting. E.g. in Scala operators are just functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With