Learn to program the Java Learning Array published, welcome to visit through Xuebiancheng8.com.
The following is an analysis of the arrays in Java.
What is an array, why use an array, join now need to count a class of exam results, this class has 30 students, how to do it, if not the array, then you have to define 30 variables to save 30 students of the results, so it is very obvious to the programmer is very painful, light 30 variables must be defined half a day, But also is not good to remember, easy to remember mixed, then how to do it, this time can be used array, the array name Incredibles is a group of numbers called array, this group of numbers using the same variable, as long as a variable can save the name of the 30 students, each student has the order, you can access through the data. Say
int score[] = new int [30];
The above defines an array, the length of this array is 30, we can use score[0]=10, to ask the first classmate's performance assignment, with Score[1] for the second classmate's performance assignment, subscript 0,1 is the order of the array, or position. After assignment, if you need access to the array using score[0] to access the first one. Use score[1] to access the second one, and so on.
For more information about arrays, please visit them via xuebiancheng8.com.
The specific URL is
Http://xuebiancheng8.com/play/goodgoodstudy_68_daydayup.html