Есть класс Field
package day0;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Field {
static final int FIELD_SIZE=10;
//List<Ship> ships;
Map<Coordinate, Cell> map = new HashMap<>();
public void printField() {
for (int i=0; i<FIELD_SIZE; i++){
for (int j=0; j<FIELD_SIZE; j++){
System.out.println(map.get(new Coordinate(i,j)));
}
}
}
Класс Координата
public class Coordinate {
int x;
int y;
boolean isAlive;
public Coordinate(int x, int y) {
this.x = x;
this.y = y;
this.isAlive = true;
}
public int getX() {
return x;
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Coordinate that = (Coordinate) o;
return x == that.x &&
y == that.y;
}
@Override public int hashCode() {
return Objects.hash(x, y);
}
public int getY() {
return y;
}
}
При выводе поля Field на котором расположены координаты корабля
public static void main(String[] args) {
Field field = new Field();
......
field.printField();
}
Получаю
Введи координаты 1-го 4 -го корабля
0,0;0,1;0,2;0,3
day0.Cell@548e7350
day0.Cell@1a968a59
day0.Cell@4667ae56
day0.Cell@77cd7a0
Как привести к нормальному ввиду обьекты вывода?