Created
April 27, 2016 15:06
-
-
Save sembozdemir/af644dfc6adc227cb913f13941951616 to your computer and use it in GitHub Desktop.
ListenerExample/Main.java
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) { | |
Scanner scanner = new Scanner(System.in); | |
RandomGenerator randomGenerator = new RandomGenerator(); | |
randomGenerator.setListener(new OnNumberGeneratedListener() { | |
@Override | |
public void onNumberGenerated(int number) { | |
System.out.println(number); | |
} | |
}); | |
while(true) { | |
scanner.nextLine(); | |
randomGenerator.requestNumber(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment