The memory structure of a one-dimensional array of Java in data structure and its characteristics

Source: Internet
Author: User

The concept of the 1{array:

An array is a collection of variables of the same type, which can be referenced using a common name. Arrays can also be defined as any type, either one-dimensional or two-dimensional. The array is accessed by its corresponding subscript. Arrays provide a way to facilitate grouping of connected information;}

2{one-dimensional arrays:

A one-dimensional array is actually a set of lists of the same variables. To create an array, you must first define the variable types of the arrays, using the declaration format of the one-dimensional array as:

Array type array name "";}

3{steps to create an array:

1: declaring an array;

2: Create space for an array

3: When the array is an object, it must be created and initialized with the arrays before use;}

There are three ways to create a one-dimensional array of 4{:

1: first declaration after creation;//int myarray[]; MyArray = new INT[10];

2: Simultaneous creation of the Declaration;//int myarray[] = new int [10];

3: Direct assignment;//int myarray[] ={1,2,3,4,5,6,7,7,8,9}

}

5{when declaring an array, there is no space for the arrays to open up for storage, and it must be initialized for it to allocate space for it:

There are two ways to initialize: The first is direct assignment, the second is to use new to initialize the array, and when you use the keyword new, only the array is opened up but not assigned a value;}

Common operations for 6{java arrays:

Defines a Java array://string [] aarray = new String [5];

The memory structure of a one-dimensional array of Java in data structure and its characteristics

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