Question: Create an immutable version of this class. Keep all methods. publicclassGame { privateintID; privatestringPlayerName; publicGame(intID,stringPlayerName) { this.ID=ID;this.PlayerName=PlayerName; } publicvoidChangePlayerName (stringNewName) { this.PlayerName=NewName; } }
Create an immutable version of this class. Keep all methods.
publicclassGame { privateintID; privatestringPlayerName; publicGame(intID,stringPlayerName)
{
this.ID=ID;this.PlayerName=PlayerName;
}
publicvoidChangePlayerName (stringNewName) { this.PlayerName=NewName; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
