Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class Start {
- public static boolean value;
- public static void main(String[] args){
- Thread thread = new Thread(){
- @Override
- public void run(){
- random();
- }
- };
- thread.start();
- while(true){
- if(value) System.out.println("Done");
- }
- }
- public static void random(){
- while(true){
- value = new Random().nextInt(5) == 0;
- }
- }
- }
- while(true){
- System.out.print(""); //Modification
- if(value) System.out.println("Done");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement