search
HomeJavajavaTutorialDetailed explanation of the relationship between Java array types

1. Relationship description

(1) Array

The array is a reference data type, and the array reference variable is just a reference (similar to the pointer in C ), array elements and array variables are in memory

(2) Object array

Since classes and arrays are both reference data types, the object array o2 in the program actually stores Reference array of class Obj.

(3) Multidimensional array

A multidimensional array is an extension of an array. It is essentially a one-dimensional array, but the array elements are also references, and the references saved in the array elements point to the one-dimensional array.

2. Example

public class Obj{
    int a;
}
public class Test{
    public static void main(String[] args){
        int array[]    = int[]{2,3,4,5,6,7,8,9};
        Obj o1         = new Obj();
        Obj o2[]       = new Obj[10];
        int array2[][] = new int[10][];
    }
}

What collection classes are there in Java?

Collections in Java are mainly divided into four categories:

1 , List list: ordered, repeatable;

2, Queue queue: ordered, repeatable;

3, Set collection: non-repeatable;

4. Map mapping: unordered, unique keys, but not unique values.

The above is the detailed content of Detailed explanation of the relationship between Java array types. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor