#
WHAT ARE INCREMENT AND DECREMENT OPERATORS AND POST FIX AND PREFIX OPERATORS IN JAVA???

2
by irasangwan

++ and -- are increment and decrement operators. Postfix operator is ++ or --. Let x= 10. Expression 5 + (x--) means x is decremented to 9. But to the + operator value returned by expression in paranthesis is equal to 10, previous value. Answer is 15. For prefix operator like -, --, ++. Let x = 10 and we have 5 + (--x) then x is decremented first, so x is now 9. Value returned by parantheses to + operator is also 9. SO answer is 14.

Log in to add a comment