Created
January 21, 2024 14:46
-
-
Save lol97/51421fe0cb236b76e1341e9f539cd125 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GameLambda { | |
interface Clickable { | |
void onClick(); | |
} | |
private Clickable action; | |
void setClickAction(Clickable action) { | |
this.action = action; | |
} | |
void handleClick() { | |
action.onClick(); | |
} | |
public static void main(String[] args) { | |
GameLambda reference = new GameLambda(); | |
reference.setClickAction(new Clickable() { | |
@Override | |
public void onClick() { | |
// TODO Auto-generated method stub | |
System.out.println("handle href from data internal"); | |
} | |
}); | |
reference.handleClick(); | |
GameLambda lambda = new GameLambda(); | |
lambda.setClickAction(() -> { | |
System.out.println("come hereee "); | |
}); | |
lambda.handleClick(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment