1. Design idea: Use random number to produce formula, recursive call, output a certain number of random number.
2. Source code:
Import Java.util.scanner;public class Suiji_2 {public static void Main (string[] args) { //TODO auto-generated Me Thod stub Scanner in = new Scanner (system.in); System.out.println ("Generate random Number:"); int M=in.nextint (); SYSTEM.OUT.PRINTLN ("Input C:"); int C=in.nextint (); Suiji (m,c); } public static void Suiji (int m,int c) { int a=1; int x= (2^10000)-1; for (int i=1;i<=m;i++) { a= ((7^5) *a+c)%x; System.out.print (A + " "); if (i%10==0) {System.out.println ();}}}}
3. Procedure:
1. Program code:
1//Methodoverload.java 2 package Testwenjian; 3 public class Methodoverload {4 5 public static void Main (string[] args) {6 System.out.println ("The Square Of integer 7 is "+ Square (7)); 7 System.out.println ("\nthe square of double 7.5 is" + square (7.5)); 8 } 9 public static int square (int x) {One return x * x;12 }13 public static Double square (double Y) { return y * y;16 }17}
2. Answer:
The two methods in the code have the same method name, but the return value type and the parameter type are different, which is the overload of the method.
Method Overloading Requirements:
(1) The method name is the same;
(2) The parameter types are different, the number of parameters is different, or the order of the parameter types is different.
Note: The return value of the method is not used as a judging condition for the method overload!
java-02-hands the Brain