java.util.Random Import; public class the Test { public static void main (String [] args) { // function_1 (); function_2 (); } / ** * The arraycopy (source array name, a starting source array to be copied element position, the target array name, starting position of the destination array element is stored, the number of elements to be copied) * * the first three elements of the array src, dest copied to the first three positions on the array * before copying element: src array element [1,2,3,4,5], dest array element [6,7,8,9,10] * after copying element: src array element [1,2,3,4,5], dest [ 1,2,3,9,10] * / public static void function_1 () { int [] = {1,2,3,4,5} the src; int [] dest = {6,7, 8,9, } 10; System.arraycopy (the src, 0, dest, 0,3); // copy source array used to implement the portion of the target element to a specified position array for (int i = 0; i <dest.length; i ++) { System.out.println (dest [I]); } } / ** * 100-999 cycles generated between three digits and the number of prints, when the number of things can be divisible by 10, the end of the run the program * / public static void function_2 () { the Random Random new new = the Random () ; the while (to true) { int NUM = random.nextInt (900) +100; System.out.println (NUM); IF (NUM% 10 == 0) { System.exit (0); } } } }
JAVA API ----- System class
Guess you like
Origin blog.csdn.net/lieanwan2780/article/details/88564192
Recommended
Ranking