• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Operator Overloading in JAVA

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

As far as i know java does not support operator overloading. But how is + operator used for string concatenation ? Will this not be called Operator overloading n why ?
Please responnd fast n thanks in advance.

Regards,
Dipti
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As written in the API:
The Java language provides special support for the string concatenation operator ( + )

This is a special support, and has nothing to do with operator overloading as in C++. It looks like one, but it's actually not part of the String class.

Please responnd fast


It is not recommended to ask things this way
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Dipti Mishra
See Java Does not supports operator overloading bcoz It takes all i/p as string thats why not needed seperatoly. And U can add like "amiy"+*+""+3.0 etc... this supports in java and thats they not thought of Operator overlading...
 
Dipti Mishra
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for such a quick response.Actually this was asked to one of my friends in the interview.....

Regards,
Dipti
 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dipti Mishra:
Hi,

Thanks for such a quick response.Actually this was asked to one of my friends in the interview.....

Regards,
Dipti




Dipti,
There is a separate forum available for these kind of questions. Here is the link Java Beginners
reply
    Bookmark Topic Watch Topic
  • New Topic