• Post Reply Bookmark Topic Watch Topic
  • New Topic

assignment operator += and this =+ difference  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see both variants work, meaning of += is clear.
for me it's not clear the meaning of this code below. Does compiler ignore + sign?
because other variants like val4=*3 or val4=/3 don't work


3
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's an int, so it can hold negative and positive numbers.

edit: See?





Without running it, what do you think this will output? Why?
 
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: there is no =+ operator.
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
another hint...what is the difference between "1" and "+1" when talking about numbers?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!