Possible Duplicate:
Java operator overload
In c++, we can perform the operator overloading. But Java is also a Object oriented language. So why java doesn’t support overloading?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually, it does support operator overloading… of a very limited, built-in only nature. For instance “+” is overloaded for String’s in addition to the usual arithmetic.
Of course, most people want to know why Java does not support user-defined operator overloading. 🙂 The simplest answer seems to be that the Java creators did not, at the time, see any clean way to add it to the language without making Java a mess (like C++) in the process.