Page 1 of 1

About Question enthuware.ocajp.i.v8.2.862 :

Posted: Fri Dec 15, 2017 8:07 pm
by Rinkesh
This will not compile because Java does not allow operator overloading for user defined classes.

Can you explain this with a example??

Re: About Question enthuware.ocajp.i.v8.2.862 :

Posted: Sat Dec 16, 2017 10:17 pm
by admin
Operator overloading allows you to define new behavior for existing operators such a +, - etc. You can do that in C/C++, but not in Java. You can see examples in c/c++ https://en.wikibooks.org/wiki/C%2B%2B_P ... verloading
but not in Java because it is not allowed.