Dear Java Programmer:
 
The add.MyEventListener is excepting an implementation and not an interface.  
The purpose of the interface was to allow access from the outside.  But clearly 
the implementation is being instantiated and then passed.  I would have passed 
the interface as the implementation details would be hidden from outside.  
Please comment.
 
public class MyEventExample {
    public static void main(String[] args) {
        // Create an event source
        MyEventSource s1 = new MyEventSource();
        // Register an event listener to the event source
        s1.addMyEventListener( new MyEventListenerImpl() );
        // Triger an event
        s1.triggerSomethingEvent("I won the lottery!");
        // Trigger another event
        s1.triggerSomethingEvent("She said Yes!");
    }//main

Respects,

JKid314159
http://existentialismagent001.blogspot.com/


      
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to