Java syntax (4): Array

Source: Internet
Author: User
Java syntax (4): array-general Linux technology-Linux programming and kernel information. The following is a detailed description. 1: array description
Arrays are special types in Java. They store a series of objects that can be referenced by indexes. In addition, you can define arrays. Below are some examples:

Int I [];
Char C [];
Float f [] [];

2: array Operators

In JAVA, array allocation is to create an array by using the new operator and then assign it to the variable, such:

Int I [] = new int [10];
In the previous example, an array containing 10 integer variables is created and assigned to I. You will get the variable I [0] in numerical order. I [1],..., I [8], I [9], note that the subscript starts from 0 of the first element and reduces the number of arrays by 1.
The use of arrays is the same as that of variables. Each array member can be used in places where similar variables are used. Java also supports multi-dimensional arrays.

Char c [] [] = new char [10] [10];
Float f [] [] = new float [5] [];
Note that in the second description, only the one-dimensional scale is determined, and Java requires that at least one-dimensional scale be determined during compilation (that is, in the source code, the scales of other dimensions can be allocated later.

Arrays are mainly used for storing a large amount of related data and accessing them simply by numbers. arrays are very powerful.
Related Article

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: 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.