Question: Explain why the class Ifem, listed below, has mutable state. Re-write the class so that it has immutable state. class Item private String name; private

Explain why the class Ifem, listed below, has mutable state. Re-write the class so that it has immutable state. class Item private String name; private int quantity: Item(String nint q){ name = n;quantity = 4; } public String name({return name:} public int quantity(){return quantity:} public void setQuantity(int q){quantity = 0;} } (6 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
