How many of these method names follow JavaBean Listener naming rules?

Given the following six method names:

* addListener
* addMouseListener
* setMouseListener
* deleteMouseListener
* removeMouseListener
* registerMouseListener

How many of these method names follow JavaBean Listener naming rules?

Given the following six method names:

* addListener
* addMouseListener
* setMouseListener
* deleteMouseListener
* removeMouseListener
* registerMouseListener

How many of these method names follow JavaBean Listener naming rules?

A.
1

B.
2

C.
3

D.
4

E.
5

Explanation:
Correct method names:
* addMouseListener
* removeMouseListener

Incorrect method names:
* addListener – missing listener’s name
* setMouseListener – there are no set methods for listeners (only add and remove)
* deleteMouseListener – there are no delete methods for listeners (only add and remove)
* registerMouseListener – there are no register methods for listeners (only add and remove)



Leave a Reply 0

Your email address will not be published. Required fields are marked *