OnJava8-Examples/housekeeping/ArraysOfPrimitives.java
2015-09-07 11:44:36 -06:00

23 lines
471 B
Java

// housekeeping/ArraysOfPrimitives.java
// ©2015 MindView LLC: see Copyright.txt
import static com.mindviewinc.util.Print.*;
public class ArraysOfPrimitives {
public static void main(String[] args) {
int[] a1 = { 1, 2, 3, 4, 5 };
int[] a2;
a2 = a1;
for(int i = 0; i < a2.length; i++)
a2[i] += 1;
for(int i = 0; i < a1.length; i++)
print("a1[" + i + "] = " + a1[i]);
}
}
/* Output:
a1[0] = 2
a1[1] = 3
a1[2] = 4
a1[3] = 5
a1[4] = 6
*/