aspose file tools*
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
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: 24187
    
  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. - What truth? - That there is no spoon!!!
 
wood burning stoves
 
subject: OPERATOR OVERLOADING ?