Map<String,Integer>[][] array = new HashMap[5][5]; Map<String,Integer> map = new HashMap<String,Integer>(); map.put("x", 100); map.put("y", 100); array[0][0] = map;
public class d { public static void main(String[] args) { Point[][] p = new Point[10][10]; Point a = new Point(1, 2); p[0][0] = a; } }class Point { private int x; private int y; public Point(int x, int y) { this.x = x; this.y = y; } public int getX() { return x; } public int getY() { return y; } }
public static void main(String[] args) { int[][] point = {{10, 20}, {30, 40}, {50, 60}}; for (int[] i : point) { System.out.println("point:"); System.out.println("x:" + i[0]); System.out.println("y:" + i[1]); } }
Map<String,Integer>[][] array = new HashMap[5][5];
Map<String,Integer> map = new HashMap<String,Integer>();
map.put("x", 100);
map.put("y", 100);
array[0][0] = map;
public class d
{
public static void main(String[] args)
{
Point[][] p = new Point[10][10];
Point a = new Point(1, 2);
p[0][0] = a;
}
}class Point
{
private int x;
private int y; public Point(int x, int y)
{
this.x = x;
this.y = y;
} public int getX()
{
return x;
} public int getY()
{
return y;
}
}
public static void main(String[] args) {
int[][] point = {{10, 20}, {30, 40}, {50, 60}};
for (int[] i : point) {
System.out.println("point:");
System.out.println("x:" + i[0]);
System.out.println("y:" + i[1]);
}
}