What a confusing question - though that's not necessarily your fault. If could be made less confusing by mentioning what your target UI toolkit is (e.g. either JavaFX or Swing).
Campbell Ritchie is correct in: "For a start one is used in Swing and the other in JavaFX.". And that makes a lot of difference because the answer is different depending on the context. For instance, JavaFX has its own javafx.event.EventHandler which is different from the java.beans.EventHandler which Campbell Ritchie references.
Basically, my advice is not to mix the two toolkits (e.g. if you import javafx.anything, don't import javax.swing.anything or java.awt.anything or java.beans.anything). There are classes in JavaFX which do pretty much everything that can be done in those other packages and if you start mixing the imports of the the toolkits up you will end up with confusion.
Documentation on how to handle events in JavaFX is here:
http://docs.oracle.com/javase/8/javafx/events-tutorial/events.htm#JFXED117
If instead you are using Swing, then documentation for using listeners for that toolkit is here:
http://docs.oracle.com/javase/tutorial/uiswing/events/index.html
Basically, the lines of code you provided do pretty similar things (add a callback which can be invoked when something occurs - in this case a button is pressed), they are just for different APIs and toolkits.