Question: 2. Learning Interface and Lambda Expression using PushCounter.java Write the following three different versions of the PushCounter.java in Listing 4.7. Create three projects, one for

2. Learning Interface and Lambda Expression using PushCounter.java

Write the following three different versions of the PushCounter.java in Listing 4.7. Create three projects, one for each version.

1) Use an external public class named MyEventHanlder to handle an action event. The class must implement the EventHanlder interface. You will need to use the this keyword in the PushCounter class to pass the object to the constructor of MyEventHandler when setOnAction() is called. See the example External Class in Moodle.

2) Use a private inner class MyEventHanlder to handle an action event. The class must implement the EventHandler interface. You will need to define the class with the private visibility within the MyEventHandler class. You do not need to use the this keyword in this version. Think why! See the example Internal Class in Moodle.

3) Use a lambda expression to handle an action event. You do not need to implement the EventHanlder interface.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!