What is the purpose of a listener in Java?

后端 未结 7 466
再見小時候
再見小時候 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 20:52

    Listeners are used for notify about state changes. You can think about Listeners in most of time as Observers, so every time something interesting happen your listener will be called.

    You can read more about patterns in Java on following websites:

    http://www.journaldev.com/1739/observer-design-pattern-in-java-example-tutorial

    http://www.developer.com/java/implementing-behavioral-patterns-in-java.html

提交回复
热议问题