there is Depot:
public class Depot
{
private final int x, y;
public Depot(int x, int y)
{
this.x = x;
this.y = y;
}
}
Im making a list of it:
ArrayList<Depot> depots = new ArrayList<>();
depots.add(new Depot(1, 2));
depots.add(new Depot(5, 7));
and they has to be passed to another method:
Object[] d2 = depots.toArray();
op((Depot[]) d2); ****
public void op(Depot[] depots)
but the **** row triggers an exception:
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Depot;