Computer Applications

The output of a++ will be 1, if int a = -1.

Java Operators

5 Likes

Answer

False

Reason — If int a = -1;, then a++ means the current value of a is used first, and then it is increased by 1. So, the output of a++ will be -1, not 1. This is because ++ is a post-increment operator, which increases the value after it is used.

Answered By

2 Likes


Related Questions