Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

polymorphism

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all ,
please let me know the difference between "+=" and "=+" and which one is the best one to go for.




Thanks in advance
Vishnu
 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

If you use '+=', you can concatenate strings or accumulate a total.

If you use '=+' it has the same effect as '='. The '+' is then evaluated on its own.

There is no '=+' op.
 
vishnu hiranamayee
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use '=+' it has the same effect as '='. The '+' is then evaluated on its own.

There is no '=+' op.


i did't get what u were trying to explain
 
Petrus Pelser
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no '=+' operator in java. In an expression, the right-hand side is evaluated first. Thus if you have an expression:
ans =+ 5;
then it is the same as:
ans =(+ 5);
which is:
ans = 5;

If you have an expression:
ans += 5;
then it is the same as:
ans = ans + 5;

Hope this is clearer.
 
vishnu hiranamayee
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Petrus Pelser,


thanks for ur reply .
so =+ and += are no way related to polymorphism?
correct?

Regards ,
Vishnu.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, they are not related to polymorphism.
 
What's that smell? I think this tiny ad may have stepped in something.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic