Java Basic Learning (ii)-arrays

Source: Internet
Author: User
First, the concept of arrays

Definition: An array is a collection of multiple elements that store the same data type.

Arrays can store either the base data type or the reference data type.

Format:

Format 1: Data type [] array name;

Format 2: Data type array name [];

This is done, but there are no elements in the array, we must initialize the arrays.

Ii. Initialization of arrays

The Java array must be initialized before it can be used. The so-called initialization is to allocate memory space for the elements of the array and assign values to each array element.

Dynamic initialization: Only the length of the array is specified when initializing, and the initial value is assigned by the system array.

Static initialization: The initialization value specifies the initial value of each array element, and the system determines the length of the array.

Java Basic Learning (ii)-arrays

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.