Array, java Array

Source: Internet
Author: User

Array, java Array

Baidu Encyclopedia:

An array is a set of elements of the same data type arranged in a certain order. It is to name a variable of the same type with a name, and then identify the set of their variables with a number, this name is called the array name and the number is called the subscript. Each variable that makes up an array is called the component of an array, also known as an element of an array, or a subscript variable. Arrays are a form of organizing several variables of the same type in order to facilitate processing in programming. The collections of these sort-by-order data elements are called arrays.

 

Format: data type array name [element];

Data Type array name [element] = {... initializing array list };

· And so on

Example:

 

Notes:

Int a [] = {1, 2, 3, 4, 5}; // The array with the initialization value list definition, without specifying the element size, the compiler calculates the number of elements in the initialization list to determine the number of elements in the array. Here, a [] is a [5] element.

Int a [5] = {1, 2, 3, 4, 5, 6}; // compilation error. Because there are 6 initialization values, a defines only five elements.

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.