0

Java operator clarification.

So we've learnt that Java does not support operator overloading, but were also taught that in Java the + operator is overloaded. Does this simply mean Java does not support user defined operator overloading because the + operator comes overloaded already? Or am lost? Clarification will be greatly appreciated.

17th Sep 2020, 6:57 PM
Michael
Michael - avatar
2 odpowiedzi
+ 4
Java does not support user defined operator overloading (and) the + operator comes overloaded already(for strings,numbers,etc)?
17th Sep 2020, 9:43 PM
Kevin ★
+ 1
Java just doesn't support operator overloading and that's it. Not because + is overloaded, but because Gosling and Co wanted to keep things simple. Such operators in Java like ++, --, += etc come out of the box for people to use. These are more of stand alone operators, rather than overloaded.
17th Sep 2020, 7:35 PM
Aleksandrs
Aleksandrs - avatar