Question: Is the following class immutable?} import java.util.Date; public class Appointment { } private Date date; private String contact; public Appointment (Date date) { this.date date;

Is the following class immutable?}

import java.util.Date; public class Appointment { } private Date date; private String

import java.util.Date; public class Appointment { } private Date date; private String contact; public Appointment (Date date) { this.date date; this. contact = contact; = } public Date getDate() { return date; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The class shown in the image is not immutable Here are the reasons why 1 The Date class in Java is mutable which means that the internal state of a Da... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithm Design Questions!