Discuss / Java / 作业

作业

Topic source

MacanRSG

#1 Created at ... [Delete] [Delete and Lock User]
publci class Main{
 public static void main(String[] args) {
Stream<Integer> stream4 = Stream.generate(new FibonacciSupplier());
stream4.limit(10).forEach(System.out::println);}
}


class FibonacciSupplier implements Supplier<Integer>{    int i = 0;    int j = 1;    @Override    public Integer get() {        int t;        t = i;        i = i + j;        j = t;//        i,j = i+j,i;        return i;    }}

  • 1

Reply