an array of names for java
int[] intArray = new int[20];
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
3.5
6
String[] names = {
"Liam",
"Olivia",
"Noah",
"Emma",
"Oliver",
"Ava",
"William",
"Sophia",
"Elijah",
"Isabella",
"James",
"Charlotte",
"Benjamin",
"Amelia",
"Lucas",
"Mia",
"Mason",
"Harper",
"Ethan",
"Evelyn"
};
Thank you!
6
0
3.5
2
For example: int[ ] num = new int[6];
public class AccessingArrayElements
{
public static void main(String[] args)
{
int[] arrNum = {25, 23, 15, 20, 24};
for(int a = 0; a < arrNum.length; a++)
{
System.out.println(arrNum[a]);
}
}
}
Thank you!
2
0
Are there any code examples left?
New code examples in category Java