Java Foundation Fourth day

Source: Internet
Author: User
Tags array length

Fourth day

To logically turn large programs into one small step

An array is a combination of multiple identical types of data that enables unified management of these data.

The elements in the array can be any data type, including the base type and the application type.

Declaring the format of an array

Declaring the format of an array

1, data type [] array name

2, data type array name []

Note: The value range of the subscript:0-----Array Length-1

Static initialization

/Initialize, specify the value of the element, determined by the system length

int [] arr = new int[]{1,2,3,5};

/*

* Array FAQ:

* 1. Array subscript out of bounds exception

* Java.lang.ArrayIndexOutOfBoundsException

* The subscript does not go out of scope, and it occurs when an index that does not exist in the array is accessed

* 2. Null pointer exception

* Java.lang.NullPointerException

* Array reference does not point to an entity, but when manipulating an element in an entity

*/

Java Foundation Fourth day

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.