下記のコードを「testSlot.java」で保存。
コンパイル、実行でOKです。


/////////////ここから

import java.lang.Math;

public class testSlot {
    public static void main(String[] args) {
 
            long stopTime = System.currentTimeMillis() + 3000;
            int randomNum=0;

	    while (System.currentTimeMillis() < stopTime){
                randomNum = (int)(Math.random() * 1000);
                System.out.printf("\b\b\b%03d", randomNum);		
	    }

	    if ( randomNum >700) {
		System.out.println("");
                System.out.println("Bingo!");		
             }

    }
}




//////////////ここまで

トップページへ。