?? randombag.java
字號:
package bingo.game;import java.util.*;import bingo.shared.*;class RandomBag implements BagOfBalls { private boolean DEBUG = false; private Vector balls = new Vector(BingoBall.MAX); private Random generator = new Random(System.currentTimeMillis()); RandomBag () { for (int j = BingoBall.MIN; j <= BingoBall.MAX; j++) balls.addElement(new BingoBall(j)); } // PENDING: the compiler wanted this public...why? public BingoBall getNext() throws NoMoreBallsException { if (balls.size() > 0) { int num = (int)(generator.nextDouble() * balls.size()); BingoBall returnThis = (BingoBall)balls.elementAt(num); balls.removeElementAt(num); return returnThis; } else { throw new NoMoreBallsException(); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -