21101 - VictoriaBrown/MyProgrammingLab_Ch10 GitHub Wiki

QUESTION:

Provide the definition of an abstract class named DesktopComponent that contains the following: - a void (abstract) method , onClicked, that accepts no parameters and is to be supplied by a subclass. - a (private ) string named type , describing the sort of Desktop component (e.g. window, icon, taskbar, etc). - a constructor accepting a string that is used to initialize the type instance variable

CODE:

public abstract class DesktopComponent {

	// Instance variable type
	private String type;

	// Constructor:
	public DesktopComponent(String type) {
		this.type = type;
	}

	// Abstract method onClicked
	public abstract void onClicked();

}