Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In Java, define a data of 1~ 100, store it in an array, and traverse it.
In Java, define a data of 1~ 100, store it in an array, and traverse it.
1. Defines an array of size 100.

int? arr[]=new? int[ 100]; //Set an integer array of size 100. 2. Circularly allocate the number 1- 100.

for(int? I = 1; I<= 100; i++){

arr[i- 1]? =? Me; //Assign a number 1- 100.

}3, traverse the array

for(int? I = 0; I < array length; I++){// The maximum value of the array is arr.length, and the array is traversed circularly.

system . out . println(arr[I]); //Output the elements in the array

}