943,920 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 5460
  • Java RSS
Oct 8th, 2007
0

Operator Defining

Expand Post »
How do you define operators in JAVA? (Can you???)
[prettyplease] help? [/prettyplease]
Reputation Points: 86
Solved Threads: 2
Junior Poster
venomlash is offline Offline
143 posts
since Oct 2006
Oct 8th, 2007
0

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.
Last edited by Ezzaral; Oct 8th, 2007 at 2:03 pm. Reason: typo
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007
Oct 8th, 2007
0

Re: Operator Defining

Okay, num_reasons_why_cpp_better_than_JAVA++;
thanks anyway, Ezzaral.
Reputation Points: 86
Solved Threads: 2
Junior Poster
venomlash is offline Offline
143 posts
since Oct 2006
Oct 8th, 2007
1

Re: Operator Defining

Click to Expand / Collapse  Quote originally posted by venomlash ...
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.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: jar command not reccognized
Next Thread in Java Forum Timeline: Java(sort/dsort)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC