Online Java Compiler By
JavaTpoint.com
//import statement import java.lang.reflect.Array; public class ReflectArraynewInstanceExample1 { public static void main(String[] args) { String[][] strarr = (String[][]) Array.newInstance(String.class, 3,3); Array.set(strarr[0], 0, "javaTpoint"); Array.set(strarr[1], 1, ".Net"); Array.set(strarr[2], 2, "c#"); System.out.println("Array[0][0] = " + Array.get(strarr[0], 0)); System.out.println("Array[1][1] = " + Array.get(strarr[1], 1)); System.out.println("Array[2][2] = " + Array.get(strarr[2], 2)); } }
Output