Get Answers to all your Questions

header-bg qa

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

Answers (1)

best_answer

Increment operators (++) increase the value of a varibale and the Decrement operators (-- ) decreases the value of the variable.

As prefix and postfix: 

Both the operators when uses as prefix (++var, --var), the value of Variable is increased or decreased by 1 and then it returns the value.

When used as postfix (var++, var--), the original value of the Variable is returned first then the value of variable is incremented or decremented by 1

 

 

Posted by

Deependra Verma

View full answer