ICSE Class 10 Computer Applications
Question 22 of 26
Operators in Java — Question 22
Back to all questions 22
Question Question 22
What is the difference between the following two statements in terms of execution? Explain the results.
x -= 5;
x =- 5;
The first statement, x -= 5; subtracts 5 from x and assigns the result back to x. It is equivalent to x = x - 5;
The second statement, x =- 5; assigns the value of -5 to x.