What is the purpose of a listener in Java?

后端 未结 7 467
再見小時候
再見小時候 2020-12-04 20:23

I looked for this online, but couldn\'t find an adequate explanation to what it exactly does. What I saw was a Java Interface and it was passed as a parameter in another cla

7条回答
  •  失恋的感觉
    2020-12-04 21:00

    Use a listener to let other code inform you of "conditions"/"events". For instance a "mouse listener" could be called if the mouse would have been moved/clicked/dragged. It depends on your application why it provides for listeners.

提交回复
热议问题