+ 8
Why does JAVA not support user define operator overloading?
The other languages like c++ supports operator overloading and it is the good thing. Operator overloading provides us to use a operator for different types of uses and overloading shows the polymorphic behavior of operators. When we overload an operator then with this operator we can perform directly operation on objects and it is beneficial for a programmer. So, why does Java not provide the facility to overload operator?
17 odpowiedzi
+ 17
I don't know the truth but write down my opinion. If a language supports operator overloading then it is easy to write program which can be understood very hard. You have to know how a class overrides different operators to understand what a code does. You can override + to work as - for example.
In Java it is important to be able to write safe and easily understandable code fast. And operator overloading breaks this goal and isn't needed at all.
+ 10
It is not really needed. Java usually implements core features with high impact, features like this only to be fancy and shiny is not really valuable for java, while you define a method instead of operator overload, and there you have the same. This is how I see they are thinking, no properties and fancy stuff, functionality comes first.
+ 9
We can't say here it is good or not. Operator overloading (as other functionalities too) has pros and cons. It has to be decided if it is worth to implement. I think it is very subjective what is important for you: simplicity, performance, safe coding, readable codes or others? It is like religion. I have been working in Java + C++ teams for 15 years about, so my opinion is Java choose the more effective way: much faster and safer development -> lower project cost and much less bugs
+ 4
Because java is a simple language that does not include ambiguous stuffs like operator overloading , multiple inheritance, Etc. Moreover, java lacks all complex operations that are supported in other languages. That's why JAVA is very famous. Famous for it's simplicity.
+ 3
Java Creator James Gosling goes by the philosophy: "When you move to a new apartment, don't unpack. Just sort of move in, and as you need things, pull them out of the boxes. After you've been in the apartment for a couple of months, take the boxes -- don't even open them -- and just leave what's in there and throw them out."
+ 1
It does support in some cases, if u are an experienced programmer u will have come across it many times
+ 1
Because while developing Java the complex functions of c/c++ were removed like pointers n operator overloading in JVM
+ 1
I think , java does not support pointers which is the main reason ,why java doesn't have operator overloading
0
In simple speak, C++ trusts the programmer and assumes they know what they're doing.
Java does not trust the programmer, and keeps them from doing certain things.
- 1
انا مبتدئة اريد ان اتعلم ارجوكم
- 1
Because it is a computer laungage
- 1
no this overloading
- 1
ووس
- 2
I think so java don't allow users to do certain things as it do not trust them
- 5
I'm try to use this app.
- 7
ووس