ICSE Class 9 Computer Applications Question 3 of 21

Operators in Java — Question 3

Back to all questions
3
Question

Question 3

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;

Get the Bright Tutorials app Stuck on a question? Ask Bright Buddy — your AI tutor — for step-by-step help in the app.