Explain how a call to the addMouseListener method in a GUI-based program represents a polymorphic situation.
What will be an ideal response?
The addMouseListener method was written years ago by a Sun Microsystems API programmer, long before any particular class you write to serve as a mouse listener. The addMouseListener method is written to take a parameter of type MouseListener (the interface). That way, any object that implements the object interface can be passed to it, even one that was just written. Because of the contract established by the interface, the component can make a polymorphic call to a method such as mouseClicked through whatever mouse listener object is provided.
You might also like to view...
The only reason to ever use ____ text is when you know your users have a very old version of the Flash Web browser plug-in.
a. TLF b. Classic c. Valence d. Heading
PowerPoint does not have the option to insert a file name using Quick Parts
Indicate whether the statement is true or false
A virtual private network is a way to use the Internet to create a connection between a remote user and a central location
Indicate whether the statement is true or false.
Repetitive stress injuries and other injuries related to the workplace environment are estimated to account for ____ of all serious workplace injuries.
A. one-tenth B. one-half C. one-third D. 80%