• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Operator Overloading in JAVA

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
 
A feeble attempt to tell you about our stuff that makes us money
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic