An array of Java

Source: Internet
Author: User

An array is a collection of elements stored in a two-part memory block, and each element in the array must be of the same data type, partitioned by an index, and the index of the first element in the array is 0.

Array length

The factor group is contiguous in the memory space, so the length of the array must be known when allocating space, and the length of the array cannot be changed.

Features of the array:

① Array is a contiguous memory space, subscript starting from 0;

② array elements are variables, and the variable type of the primary color is the type of the definition array;

③ array elements are initialized when they are created;

After the ④ array is created, the length cannot be changed.

Create an array

data type [] array variable name;

Or

Data type array variable name [];

Initialization of the array

There are generally two ways to initialize an array, one is to assign values directly when the array is created and initialized, such as: int[] array={,1,2,4,5,8,7,9,5,4,56};

Another way is to initialize the array first, and then assign values to the array by the subscript of the array.

An array of Java

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.