Question: Given the following class, how would you make it immutable, Re-write it by making the necessary changes. public class Movie ( (b) } public
Given the following class, how would you make it immutable, Re-write it by making the necessary changes. public class Movie ( (b) } public String title; public String director; public int runTime; public Movie (String title, String director, int runTime) { } this.title= title; this.director director; this.runTime = runTime; public int calculateExtendedRuntime (int time) ( runTime += time; return runTime; (8 marks)
Step by Step Solution
3.39 Rating (161 Votes )
There are 3 Steps involved in it
To make the Movie class immutable you need to ensure that its state cannot be changed after it is constructed To accomplish this you should 1 Make all ... View full answer
Get step-by-step solutions from verified subject matter experts
