+1 vote
in Scala Constructs by

Does Scala support Operator Overloading? Does Java support Operator Overloading?

1 Answer

0 votes
by
Java does not support Operator Overloading. Scala supports Operator Overloading. The reason is that Java does not want to support some misleading method names like “+*/”. Scala has given this flexibility to Developer to decide which methods/functions name should use. When we call 2 + 3 that means ‘+’ is not an operator, it is a method available in Int class (or it’s implicit type). Internally, this call is converted into “2.+(3)”.

Related questions

0 votes
asked Sep 12, 2022 in Scala Constructs by Robin
0 votes
asked Sep 12, 2022 in Scala Constructs by Robin
...