Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Change element in array Java

String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
System.out.println(cars[0]);

// Change elements in array
cars[0] = "Opel";
System.out.println(cars[0]);

// Length of array
System.out.println(cars.length);

// Loop through array
for (int i = 0; i < cars.length; i++) {
  System.out.println(cars[i]);
}
 
PREVIOUS NEXT
Tagged: #Change #element #array #Java
ADD COMMENT
Topic
Name
5+4 =