java - Can we use the Lambda Expression for WindowListener? if yes how? if no why? Can i set the Lambda Expression for the below code snippet? -


this question has answer here:

this.addwindowlistener(new windowadaptor(){ public void windowclosing(windowevent we) {     system.exit(0);//to close window } }); 

this request, please make code using lambda expression.

a lambda expression can substitute functional interface (i.e. interface single non default method). therefore windowadapter, has multiple methods (windowactivated(windowevent e), windowclosed(windowevent e), windowclosing(windowevent e), ...), can't substituted lambda expression.


Comments