• Post Reply Bookmark Topic Watch Topic
  • New Topic

Operators in java  RSS feed

 
Mikasa Jaeger
Greenhorn
Posts: 24
Chrome Google App Engine Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know what they are for these operators:

^=
<<=
>>>=
%=
&=

Thanks!
 
Paweł Baczyński
Bartender
Posts: 2074
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read this?
If you have, just tell us what you don't understand.
If you haven't, just do it.
 
Mikasa Jaeger
Greenhorn
Posts: 24
Chrome Google App Engine Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, i'd read this.
But I don't know differences between the each one.

It's the same <<= that &=
What's the difference in the assignment of each one?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ouyeahh Manjon wrote:It's the same <<= that &=

Those two are completely different.

<< is the left shift operator; it shifts all the bits of the number that you are shifting one bit to the left.
& is the bitwise AND operator.

Note that "x op= y" means the same as "x = x op y". So, for example x <<= 3 is the same as x = x << 3.
 
Mikasa Jaeger
Greenhorn
Posts: 24
Chrome Google App Engine Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jasper!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!