Skip to main content
deleted 1 characters in body
Source Link
gnat
  • 20.5k
  • 29
  • 117
  • 310

The only way you can make a Java object immutable is from withingwithin the class of that object itself and not from other calling classes.

You may only have constant pointer (final reference by the official Java name) meaning that you cannot modify the reference to point to another object; you cannot have pointer to constant, meaning you cannot modify the referring object, as you may have in C/C++.

The only way you can make a Java object immutable is from withing the class of that object itself and not from other calling classes.

You may only have constant pointer (final reference by the official Java name) meaning that you cannot modify the reference to point to another object; you cannot have pointer to constant, meaning you cannot modify the referring object, as you may have in C/C++.

The only way you can make a Java object immutable is from within the class of that object itself and not from other calling classes.

You may only have constant pointer (final reference by the official Java name) meaning that you cannot modify the reference to point to another object; you cannot have pointer to constant, meaning you cannot modify the referring object, as you may have in C/C++.

Source Link
Random42
  • 10.5k
  • 10
  • 52
  • 65

The only way you can make a Java object immutable is from withing the class of that object itself and not from other calling classes.

You may only have constant pointer (final reference by the official Java name) meaning that you cannot modify the reference to point to another object; you cannot have pointer to constant, meaning you cannot modify the referring object, as you may have in C/C++.