An array of Java learning (i)

Source: Internet
Author: User

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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.