Num sides cannot be reassigned if it is declared as final. There'd be no risk of multiple threads reading different values due to it not being declared as volatile.
So, declaring the variable as final
makes the class thread safe. As of now its not thread safe.
Declaring an object final keeps its reference from being reassigned, however if the object had internal data, that data could be reassigned which would not be thread-safe. This is an important point made by Colin on another answer.
In this case the data is a primitive, and so has no internal data. So here, declaring it final works fine.