Online Java Compiler By
JavaTpoint.com
//import statement import java.lang.reflect.Array; import java.util.Arrays; public class ReflectArraygetLengthExample1 { public static void main(String[] args) { int[] valarr = { 890, 980 }; int[] valarr2 = new int[2]; for (int i = 0; i < Array.getLength(valarr); i++) { Array.set(valarr2, i, Array.get(valarr, i)); System.out.println(Array.get(valarr2, i)); } System.out.println(Arrays.toString(valarr2)); } }
Output