20190927

1.

import java.util.Scanner;

public class T {
    public static void main(String[] args) {
        long c = 0;
        long i = 0;
        long x = 1;
        Scanner ipt = new Scanner(System.in);
        System.out.println("Please enter the amount");
        c = ipt.nextInt();
        ipt.nextLine();
        for (i = 0; i < c; i++) {
            x = (2147483647 * x + 0) % 16807;
            System.out.printf("%d Random is %d\n", i + 1, x);
        }
        ipt.close();
    }
}

 2.Java里也有重载,通过方法名相同参数不同,同时,返回值的参数不同不能作为重载的判断条件。System.out.println()方法是System类中的一个方法,也进行了重载来应对参数为String类、boolean型等情况。

猜你喜欢

转载自www.cnblogs.com/minadukirinno/p/11599770.html