What will be the value of variable a after the following code is executed?
int а = 7;
a /= 2;
The compound assignment operator is equivalent to:

a = a / 2;
Since a and 2 are of int type, then a/2 will perform an integer division, therefore a/2 = 3.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты