code to explanationWed, 28 Dec 2022

public class DvdName { private String titleName; public DvdName(String titleName) { this.setTitleName(titleName); } public final void setTitleName(String titleNameIn) { this.titleName = titleNameIn; } public final String getTitleName() { return this.titleName; } public void setNameStarsOn() { this.setTitleName(this.getTitleName().replace(' ','*')); } public void setNameStarsOff() { this.setTitleName(this.getTitleName().replace('*',' ')); } public String toString() { return ("DVD: " + this.getTitleName()); } }

The above class is the DvdName class. This class shows the title of the DVD stored in a String. There are setter and getter methods to manipulate the title name. There are also methods that replace spaces with stars, and vice-versa.

Questions about programming?Chat with your personal AI assistant