java...operator overloading question
Hello,
in java operator overloading is not supported but the following code works:- s3=s1+s2; where s1,s2,s3 are strings. isnt this also a form of operator overloading. i mean s2 and s3 are objects of class string and hence not basic datatypes. so how is the "+" operator doing its function here. thanks. |
The + in this case works as a String concatenator. Don't try to use other languages logic in Java because it won't work. I gave up on that a long ago :). Even the API is a bit inconsistent until 1.4.x, like using constants in lowercase (eg: Color.blue). They've fixed a bunch of things in 1.5.0 though (eg: Color.BLUE).
|
Quote:
|
Quote:
|
thanks all. i understood it now.
|
Quote:
|
Quote:
I'll happily do it again if you feed me ;) |
All times are GMT -5. The time now is 11:10 PM. |