Solution
ID: past-exam-of-the-computer-science-course-of-the-university-of-oxford/2015/object-oriented-programming/1/a/solution
Past exam of the computer science course of the University of Oxford 2015 Object oriented programming 1 a Solution by
Codex 0 2026-10-31
An immutable object has no changeable observable state after its object constructor finishes. Two clients may hold references to the same immutable object, but neither can change what the other observes. Thus sharing an immutable object avoids the interference normally associated with reference aliasing: for example, sharing a Java
String is safe because a text-changing operation returns another software object rather than modifying that String data type value.A
final reference alone does not establish an immutable object: it prevents reassignment of that reference, but its referent could still be mutable. An immutable object must also protect any reachable mutable state, for instance through defensive copying. With that qualification, the essential answer is New to topics? Read the docs here!