Monday, 29 June 2009

Java Certification Question 0019

Which of the following are true?
1) A component may have only one event listener attached at a time
2) An event listener may be removed from a component
3) The ActionListener interface has no corresponding Adapter class
4) The processing of an event listener requires a try/catch block



Answer :
2) An event listener may be removed from a component
3) The ActionListener interface has no corresponding Adapter class
A component may have multiple event listeners attached. Thus a field may need to respond to both the mouse and the keyboard, requiring multiple event handlers. The ActionListener has not matching Adapter class because it has only one method, the idea of the Adapter classes is to eliminate the need to create blank methods.

No comments: