Why Groovy constants can be incremented?

Viewed 844

In Groovy Console , ++(++(++(++1++)++)++)++ evaluates to 5 !
Why ?
I would expect an error that literal constants can not be incremented !

Pre-Increment gives the next Integer, while Post-Increment gives the same Integer, but I would expect both to throw errors when used with literal constants.

[[ I am running this on Windows 10 with Groovy 2.4.10 with Java 1.8.0_101 ]]

1 Answers
Related