Multiple choice technology architecture

How do you change the value that is encapulsated by a wrapper class after you have instantiated it ?

  1. Use the setXXX() method defined for the wrapper class.

  2. Use the parseXXX() method defined for the wrapper class.

  3. Use the equals() method defined for the wrapper class.

  4. The value encapsulated by a wrapper class is immutable.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Java wrapper classes are immutable, meaning their values cannot be changed after instantiation. Methods like setXXX() do not exist on wrapper classes. To work with a different value, you must create a new wrapper instance. This design ensures thread safety and allows for caching of frequently used values.