http://www.verejava.com/?id=16992640551624
/* Array Classification 1. One-dimensional array 1.1 definition and initialization of one-dimensional array 1.2 operations on a one-dimensional array, traversal, add, insert, modify, delete, sort, find 2. Two-dimensional array 2.1 The definition and initialization of a two-dimensional array 2.2 The traversal of a two-dimensional array 3. Multidimensional Array 4. Enhanced for Loop */public class array{public static void Main (string[] args) {//one-dimensional array definition and initialization//static definition one-dimensional array Int[] scores={90,70,50,80,60,85}; Dynamically define one-dimensional arrays int[] arr=new int[6]; arr[0]=90; arr[1]=70; arr[2]=50; arr[3]=80; arr[4]=60; arr[5]=85; One-dimensional array traversal, printing the scores for the group scores for (int i=0;i<scores.length;i++) {System.out.print (scores[i]+ ","); The}}//array is a string of 1public class Test1 {public static void main (string[] args) {//A set of books is placed on the bookshelf to print out the title of this group of books Create a book shelf, define an empty storage book array 0,1,2,3 string[] books=new string[4]; 4 is the length of the array//the book is deposited into an array books books[0]= "Jobs biography"; Books[1]= "From Excellence to Excellence"; Books[2]= "Life does not set limits"; Books[3]= "attitude decides everything"; Print out the title of this group of books//system.out.println (books[2]); Traversal of an arraySystem.out.println (books.length); The number of elements in the array for (int i=0;i<books.length;i++) {System.out.println (books[i]); The}}//array is a string of 2public class Test2 {public static void main (string[] args) {//defines an initialized array in T a=0; String[] books={"Jobs biography", "from excellent to excellent", "Life is not set limits", "Attitude decision everything"}; for (int i=0;i<books.length;i++) {System.out.println (books[i]); }//Wang Tao in the examination of Chinese, mathematics, English, respectively, int[] scores={90,95,100}; for (int i=0;i<scores.length;i++) {System.out.println (scores[i]); } }}
http://www.verejava.com/?id=16992640551624
One-dimensional array of Java arrays