Opening Week and the third function overloading

Overloaded functions based on: 1, the type of parameter 2, 3 number of parameters, the parameters of the sequence (at different parameter types and with more than two and two parameters)

Still overloaded functions can realize the above principles, the following examples of related only give the number of functions:

Source code for:

package three;

import java.util.Scanner;
import java.util.Random;

Rand class {public
static new new Scanner Scanner SC = (the System.in);
public static void main (String [] Arg) {
int NUM;
System.out.println ( "Please select the number of the random number output:");
NUM = sc.nextInt ();
RAND (NUM);
System.out.println ( "Please select the output of the random number and the number of how many numbers wrap:");
NUM = sc.nextInt ();
int num2 = sc.nextInt () ;
RAND (NUM, num2);
}
public static void RAND {(int A)
the Random = new new new_num the Random ();
int num1;
the while (A = 0!) {
num1 = new_num.nextInt (101);
num1 = (16807 num1 *)% 2147483647;
of System.out.print (num1 + "");
A--;
IF (A% 10 == 0) {
System.out.println ();
}
}
}
public static void rand(int a,int b) {
Random new_num=new Random();
int num1;
while(a!=0) {
num1=new_num.nextInt(101);
num1=(16807*num1)%2147483647;
System.out.print(num1+" ");
a--;
if(a%b==0) {
System.out.println();
}
}
}
}

Screenshot:

Guess you like

Origin www.cnblogs.com/studya/p/11600051.html