In C++, one can define a const method:
class MyClass {
void myMethod() const {
.. code ..
};
};
The const here means that this method has only read permissions to this. I.e., it cannot make any change to the object it works on. It can only make read operations on it.
Is there an equivalent in Java for const method?