package com.boda.xy;
public interface IntSequence {
public abstract boolean hasNext();
public abstract int next();
}
-----------------------------
package com.boda.xy;
public class RandomIntSequence implements IntSequence{
private int n;
public boolean hasNext(){
n = 10 + (int)(Math.random()*90);
return true;
}
public int next(){
return n;
}
}
public static void main(String[] args) {
IntSequence sequence = new RandomIntSequence();
System.out.println(sequence.hasNext());
System.out.println(sequence.next());
}
}