This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes OPERATOR OVERLOADING ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "OPERATOR OVERLOADING ?" Watch "OPERATOR OVERLOADING ?" New topic
Author

OPERATOR OVERLOADING ?

manusks sharma
Greenhorn

Joined: Dec 26, 2003
Posts: 2
I HAVE READ SOMEWHERE THAT UNLIKE MANY OTHER PROGRAMMING LANGUAGES ,JAVA DOES NOT SUPPORT OPERATOR OVERLOADING;BUT THEN WHAT ABOUT + OPERATOR? DOES IT LEAD TO CONCATENATION AS WELL AS ADDITION (AND IS HENCE BEING OVERLOADED)???
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

SORRY TO HEAR ABOUT YOUR BROKEN CAPS LOCK KEY. HERE, MAYBE I CAN UNSTICK IT... there, that's better.
The built-in "+" operator is indeed overloaded to mean string concatenation as well as addition. Depending on the language you're comparing Java to, you might also think that "/" (for example) is overloaded to mean both integer and floating-point division.
But Java doesn't let you define your own meanings for operators, and that's what you read. The built-in meanings are all you've got.


[Jess in Action][AskingGoodQuestions]
Vicken Karaoghlanian
Ranch Hand

Joined: Jul 21, 2003
Posts: 522
Originally posted by Ernest Friedman-Hill:
SORRY TO HEAR ABOUT YOUR BROKEN CAPS LOCK KEY. HERE, MAYBE I CAN UNSTICK IT... there, that's better.

*Vicken rolling around laughing his guts out*
[ December 26, 2003: Message edited by: Vicken Karaoghlanian ]

- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. <br />- What truth? <br />- That there is no spoon!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: OPERATOR OVERLOADING ?