[Java] array

Array definition

Data type [] Array name = {};


String[] names = {"tanaka" , "sato" , "suzuki"};
System.out.println(names[0]);

Array for statement

Output all the contents of the array.

** Normal for statement **


String[] names = {"tanaka" , "sato" , "suzuki"};

for(int i = 0; i < names.length; i++) {
  System.out.println(names[i]);
}

** Extended for statement ** for (data type variable: array name) {}


String[] names = {"tanaka" , "sato" , "suzuki"};

for(String name:names) {
  System.out.println(name);
}

Recommended Posts

[Java] array
Java array
Java array
java (array)
Java array
[Java] Array
Java array
java array
[Java] Array
java array variable
[Java] Array notes
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] Convert ArrayList to array
[Java Silver] Array generation method
How to initialize Java array
[Beginner] Java basic "array" description
Java learning (0)
Studying Java ―― 3
Java protected
[Java] Annotation
[Java] Module
[Ruby] Array
Studying Java ―― 9
Java scratch scratch
Java tips, tips
Array practice
Java methods
Java method
java (constructor)
[Java] ArrayDeque
java (override)
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 memorandum
☾ Java / Collection
Studying Java ―― 1
[Java] Polymorphism
Studying Java # 0
Java review
java framework
Java features