March 2002
Intermediate to advanced
496 pages
8h 51m
English
When a client changes the state of an object, the state changes for every client that has access to the object. This is no problem when there is only a single client, which is the most ordinary case. When multiple clients will share access to an object, the easiest and most common way to keep clients from affecting one another is to restrict clients from introducing any state changes in the shared object. You can achieve this by making an object immutable so that once created, the object cannot change. The most common immutable objects in Java are instances of the String class. Once you create a string, neither you nor any client with access to the string can change its characters.
|
Read now
Unlock full access