Explain Java’s delegation event model - Java

Explain Java’s delegation event model

The event model is based on the Event Source and Event Listeners. Event Listener is an object that receives the messages / events. The Event Source is any object which creates the message / event. The Event Delegation model is based on – The Event Classes, The Event Listeners, Event Objects.

There are three participants in event delegation model in Java;

- Event Source – the class which broadcasts the events
- Event Listeners – the classes which receive notifications of events
- Event Object – the class object which describes the event.

An event occurs (like mouse click, key press, etc) which is followed by the event is broadcasted by the event source by invoking an agreed method on all event listeners. The event object is passed as argument to the agreed-upon method. Later the event listeners respond as they fit, like submit a form, displaying a message / alert etc.
Describe the assert keyword - Java
The programmer assumes certain code while developing when handling exceptions. For example, a number is passed as parameter to a method and it is to be validated whether it is positive...
Why a native method might be useful? - Java
Java Native methods are useful when an application can not be written completely in Java language. For instance, when a Java application needs to modify an existing application which was developed in another language...
Use of shift operator in Java
Using shift operators in Java we can 1. Integer division and multiplication is done faster...
Post your comment