Hands-on brain 1: Random Number
package Test; import java.util.Scanner; import java.util.Random; public class Test { public static void main(String[] args) { Random ra =new Random(); Scanner input=new Scanner(System.in); int n=input.nextInt(); for(int i=1;i<=n;i++) { int a=ra.nextInt(100)+1; System.out.println(a); } } }
You can generate random numbers, but about being part no repeat of things right, and then have to continue access to information for this purpose.
Hands-on brain 2: observe the following code
This piece of code, which has two methods, although the different types, but call square.
This involves a method of overload
Same as (1) a method name; product
(2) different types of parameters, number of different parameters, different parameters or the type of order.
A plurality method satisfies these two conditions can overload, the return value as a determination condition is not a method of method overloading.