I am trying to follow this guide to parsing an array on an Oracle website, which does not seem to work. Since this is Oracle's own documentation, I'm just wondering if I'm not doing something wrong:
Object matrix = Array.newInstance(int.class, 2); Object row0 = Array.newInstance(int.class, 2); Object row1 = Array.newInstance(int.class, 2); Array.setInt(row0, 0, 1); Array.setInt(row0, 1, 2); Array.setInt(row1, 0, 3); Array.setInt(row1, 1, 4); Array.set(matrix, 0, row0);
Now I know that in Java 2d, arrays are basically just nested arrays, so theoretically this should work. Did I miss something?
Thanks!
source share