i want to to use an interface to nofify from one class to another(both classes are unrelated) that a process has finished. I would like to know if is possible to do that with an interface or if there is a better way to do it.
An interface is a contract that says any implementing class must implement the methods defined in the interface. It can't include any code to actually send and receive messages.
That said, creating an interface to define the notification methods is a good idea. An interface is a nice abstraction. The JDK includes an Observer interface along with an Observable class that might do the job for you. Look into the JavaDoc and see if they'll fit.
Before I learned about Observable/Observer I wrote my own little pub-sub routine - a one-abstract-class-framework. If Observable doesn't work out for you I'd be happy to discuss my code. We usually don't hand out complete solutions in this forum - it's much more fun and educational if you work out the tricky bits yourself. So see what you can get going, post some code, we'll talk some more. [ April 04, 2005: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
They gave me pumpkin ice cream. It was not pumpkin pie ice cream. Wiping my tongue on this tiny ad: