LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Operator Overloading - Java? (https://www.linuxquestions.org/questions/programming-9/operator-overloading-java-145218/)

Tesl 02-12-2004 08:54 AM

Operator Overloading - Java?
 
Iv not been able to find anything on this, and if i could get a response to this in the next couple of hours that would be great :)

Basically, is it possible? iv always found operator overloading helpful in C++, and i was hoping i could do something similar with Java, but i cant find how to do this?

If anyone could let me know how its done it would be greatly appreciated :) Otherwise il just have to live without =/

adamjaskie 02-12-2004 09:37 AM

Im pretty sure it can't be done. Java apparently doesn't have this feature. I wish it did. Was very nice when I was doing C++.

Cand1e 02-12-2004 09:39 AM

no-can-do I'm afraid what are you trying to do anyway? I might be able to suggest a way 2 do it in java.

moeminhtun 02-12-2004 11:27 PM

Java doesn't support operator overloading.

UltimaGuy 02-13-2004 12:54 AM

Java doesn't offer users operator overloading. But it uses operator overloading. The "+" symbol in print statements is an overloaded operator. But the Java creator's thought that programmer's don't need this feature and so didn't provide it.

The prescribed method is to use functions, functions and more functions. You can use function overloading though, which is helpful :).


All times are GMT -5. The time now is 05:11 PM.