[Java] Array

Reference "Introduction to Java that can be clearly understood p133 ~ p164"

Chapter 4 Summary

There was an ambiguous part about the arrangement, so I reviewed it with "Clearly understand".

First, in the image below, the meaning of using an array is

hairetu.png

If you write it like this ・ It is troublesome when the number of subjects increases ・ Cannot be processed together

Inconvenience such as occurs.

Therefore, a data structure that stores a plurality of data of the same type in the order of arrangement is an "array".

** * Note that array elements start at 0. ** **

The array in the above example is

int[] score = new int[]

Can be rewritten with.

hairetu1.png

The number of elements in the array is

Array variable name.length

Can be obtained at.

It is also possible to rotate an array with a for loop or an extended for statement.

・ For loop

for(int = 0; i <Array variable name.length; i++)

・ In the case of extended for statement

for(Element type Variable name (optional):Array variable name)

Impressions

I wanted to learn about the ArrayList class, but it didn't seem to be mentioned in this reference book. However, I learned a lot about the basics of arrays. I thought it was easy to understand even for beginners like me. I thought that using arrays as well as variables would make the code smarter at once.

It can be turned with two, a for loop and an extended for statement, but I can use the extended for statement. I thought it would be easier to see if I removed the loop variables and subscripts.

Next, I will write about object orientation.

Recommended Posts

[Java] array
Java array
Java array
java (array)
Java array
[Java] Array
Java array
java array
[Java] Array
java array variable
Array
About Java Array List
Java
[Java ~ Array ~] Study memo 4
Java
Array
[Java] List type / Array type conversion
Java Development Basics ~ Exercise (Array) ~
[Java Silver] Array generation method
[Beginner] Java basic "array" description
Java learning (0)
Java protected
[Java] Module
[Ruby] Array
Studying Java ―― 9
Java scratch scratch
Java tips, tips
Array practice
Java methods
Java method
[Java] ArrayDeque
java (method)
Java Day 2018
Java string
Java learning memo (creating an array)
Java static
Java serialization
java beginner 4
JAVA paid
Studying Java ―― 4
Java (set)
java shellsort
[Java] compareTo
Studying Java -5
java reflexes
java (interface)
☾ Java / Collection
Studying Java ―― 1
[Java] Polymorphism
Studying Java # 0
Java review
java framework
Java features
[Java] Inheritance
FastScanner Java
Java features
java beginner 3
Java memo
java (encapsulation)
Java inheritance
[Java] Overload