Home> Java> javaTutorial> body text

How to use java array

coldplay.xixi
Release: 2020-08-18 11:35:12
Original
3441 people have browsed it

How to use Java arrays: First declare the array before use and tell the computer what the data type is; then allocate space and tell the computer to allocate several consecutive spaces; finally assign a value to the array.

How to use java array

[Related learning recommendations:java basic tutorial]

How to use java arrays:

1. We have learned the definition and meaning of arrays in Java, but how to use them? When we experiment with arrays, we use the keyword NEW to instantiate the array before it can be used. We will introduce it in detail starting from the fifth step.

How to use java array

#2. Declare the array before use. Declaring an array tells the computer what the data type is. The specific implementation steps are as follows

How to use java array

#3. Then allocate space. Allocating space is to tell the computer to allocate several consecutive spaces.

How to use java array

#4. Finally assign a value to the array. Assigning a value to an array means putting data into the allocated grid.

How to use java array

#5. How to assign a value to an array. Above we introduced assigning values to arrays, but how to assign values specifically? There are generally two situations, which are also the most commonly used situations. Remember not to make the size of the array exceed the length.

How to use java array

Related learning recommendations:Programming video

The above is the detailed content of How to use java array. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!