Which of the following will NOT correctly increment the value by one of a previously initialized integer variable named counter?


counter + 1;

counter++;

counter = counter + 1;

counter += 1;

All of the above will correctly increment the value by one.

Respuesta :

counter + 1; will raise the value by one but it will not set the value of counter to itself + 1, therefore,

counter + 1; is the correct answer