This was added a couple of years ago https://docs.oracle.com/en/java/javase/17/docs/api/java.base....
I was thinking that would make it possible to create unmodifiable data objects using that (and not Object as base class).
I was thinking that would make it possible to create unmodifiable data objects using that (and not Object as base class).
In C++ you can write a class with some methods that mutate, and some const methods that can't mutate anything, and you can pass around const references through which mutation is guaranteed to be impossible. This all comes for free.