O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.2. Operator overloading

Operator overloading is a new concept to Java developers since Java doesn't allow operator overloading. [3], [4]

[3] Some Java programmers may want to argue that the + operator in Java is a pseudo-overloaded operator when it is used for concatenating strings. This is a special case whereby the compiler actually decides if you are doing a numerical addition or a string concatenation depending on the operand types, and hence shows a little 'operator overloading' behavior.

[4] Operator overloading is a feature in C++ though.

In brief, operator overloading allows you to write special methods (called operators, or operator methods) which are invoked when an overloaded operator is used to perform an operation on one or more ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required