Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
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.
2 Respostas
+ 4
Java does not support user defined operator overloading (and)Ā the + operator comes overloaded already(for strings,numbers,etc)?
+ 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.