Computer Science
Explain the meaning of the following short hand operators:
+=
<<=
*=
>>=
%=
/=
!=
Values & Data Types Java
2 Likes
Answer
| Operators | Meaning |
|---|---|
| += | It is 'Add AND assign' operator. It adds right operand with left operand and assigns the result to the left operand. Example: a += b; is equivalent to a = a + b; |
| <<= | It is 'Left Shift AND assign' operator. It shifts the binary pattern of the left operand by defined number of bits left and assigns the result to the left operand. Example: a <<= 2 is equivalent to a = a << 2; |
| *= | It is 'Multiply AND assign' operator. It multiplies right operand with the left operand and assigns the result to the left operand. Example: a *= b; is equivalent to a = a * b; |
| >>= | It is 'Right Shift AND assign' operator. It shifts the binary pattern of the left operand by defined number of bits right and assigns the result to the left operand. Example: a >>= 2 is equivalent to a = a >> 2; |
| %= | It is 'Modulus AND assign' operator. It divides the left operand by right operand and assigns remainder to the left operand. Example: a %= b is equivalent to a = a % b |
| /= | It is 'Divide AND assign' operator. It divides the left operand by right operand and assigns the result to the left operand. Example: a /= b is equivalent to a = a / b |
| != | It is 'not equal to' operator. It checks if values of its two operands are unequal or not. If its operands are not equal, it returns true otherwise it returns false. Example: a != b ⇒ true if a and b are not equal otherwise false. |
Answered By
3 Likes
Related Questions
Fill in the blanks:
_________ operator is also known as the conditional operator.
Fill in the blanks:
The null literal is represented as _________.
Arrange these operators according to their precedence:
Operators Precedence of Operators Logical AND Additive Relational Conditional Multiplicative Logical OR Assignment Postfix What is meant by Token? Name all the tokens which are used in Java.