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 interface ClapInterface { | |
void onClick(); | |
} | |
public class Below50 implements ClapInterface { | |
@Override | |
public void onClick() { | |
System.out.println("You clapped!"); | |
} | |
} | |
public class Above50 implements ClapInterface { |
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 interface Reaction { | |
void click(); | |
void hover(); | |
} | |
public class Haha implements Reaction { | |
public void onClick() { | |
System.out.println("Show Haha emoji"); | |
} | |
public void onHover() { | |
System.out.println("Haha"); |
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 Main { | |
public static void main(String[] args) { | |
LikeButton likeButton = new LikeButton(); | |
likeButton.onClick(); //Like the post | |
} | |
} |