DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   Operator Defining (http://www.daniweb.com/forums/thread92156.html)

venomlash Oct 8th, 2007 1:47 pm
Operator Defining
 
How do you define operators in JAVA? (Can you???)
[prettyplease] help? [/prettyplease]

Ezzaral Oct 8th, 2007 2:03 pm
Re: Operator Defining
 
No, operator overloading is not possible in Java. The only thing you can do is add methods for the operations you need.

venomlash Oct 8th, 2007 7:14 pm
Re: Operator Defining
 
Okay, num_reasons_why_cpp_better_than_JAVA++;
thanks anyway, Ezzaral.

Ezzaral Oct 8th, 2007 7:35 pm
Re: Operator Defining
 
Quote:

Originally Posted by venomlash (Post 447583)
Okay, num_reasons_why_cpp_better_than_JAVA++;
thanks anyway, Ezzaral.

Well, you are welcome to that opinion of course, but operator overloading isn't really all that special and probably causes more confusion than it's worth. It's syntactic sugar and might save you a couple characters typing, but you can achieve the exact same functionality with methods that perform the operations and no one has to wonder what "+" or "-" does in a given context.


All times are GMT -4. The time now is 10:09 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC