so i'm coming from a c#.net background,, and i'm trying to do this in java
Class A{
public delegate void EventHandler();
public static event EventHandler workComplete();
void doWork(){
// DO WORK
}
void onWorkComplete(){
// Riase Event
workComplete();
}
} Class Main{
A a = new A();
a.workComplete += () -> {
// On Class A Complete Work
Console.WriteLine("Work Complete");
`
};
}
I search for delegates in Java sense event are requers delegates as in c#.net,, but it's look like that Java don't have delegates ,, then i star to search how events work in Java then i fall into three things 1- Action Listener 2- Events Listener 3- and a lot of interfaces 4- observer pattern
and it's all mix up to me ,, maybe because i just understand C# events that's uses delegates.
So if any one could give a sample example like the c#.net code above ,,, in Java that's will be a very helpful.
Thank You.