ICSE Class 10 Computer Applications Question 5 of 26

Operators in Java — Question 5

Back to all questions
5
Question

Question 5

Explain the shorthand assignment operator with an example.

Answer

Java provides shorthand assignment operators for all the arithmetic binary operators. Shorthand assignment operators follow the below syntax:

variable = variable operation expression;

Taking the example of shorthand addition operator, the expression x = x + 3 can be rewritten as x += 3;