Java
1
Вклад в тег
import java.util.Arrays;
public class Test {
public static void main(String[] args) {
Star[] stars = new Star[4];
stars[0] = new Star(0, 0);
stars[1] = new Star(1, 0);
stars[2] = new Star(0, 1);
stars[3] = new Star(1, 1);
System.out.println(Arrays.toString(stars));
}
static class Star {
int x;
int y;
public Star(int x, int y) {
this.x = x;
this.y = y;
}
@Override
public String toString() {
return "Star{" +
"x=" + x +
", y=" + y +
'}';
}
}
}
[Star{x=0, y=0}, Star{x=1, y=0}, Star{x=0, y=1}, Star{x=1, y=1}]