Why does Java not support operator overloading ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does Java not support operator overloading ?

25th May 2017, 7:11 PM
Saurabh Sharma
Saurabh Sharma - avatar
3 Answers
+ 3
Java only allows arithmetic operations on elementary numeric types. It's a mixed blessing, because although it's convenient to define operators on other types (like complex numbers, vectors etc), there are always implementation-dependent idiosyncrasies. So operators don't always do what you expect them to do. By avoiding operator overloading, it's more transparent which function is called when. A wise design move in some people's eyes.
25th May 2017, 7:23 PM
Eremie Gillowei
Eremie Gillowei - avatar
0
ask from creator of java. use kotlin it support operator overloading
25th May 2017, 7:15 PM
MR Programmer
MR Programmer - avatar
0
That's not an answer
25th May 2017, 7:16 PM
Saurabh Sharma
Saurabh Sharma - avatar