Tuesday, April 10, 2012

What difference is between prefix and postfix operator in java? ++a , a++

1) The prefix ++ operator first increments the value by one and then returns the new value.
while The postfix ++ operator first returns the value and then increments it.

2) prefix will increment first and assigns to the variable postfix will assing the value to the variable and then increments

No comments:

Post a Comment