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
LANGUAGE: JAVA
CHALLENGE:
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
SOLUTION:
public abstract class DesktopComponent{ public abstract void onClicked(); private String type; public DesktopComponent(String theType){ type = theType; } }