What is happening is this:
In your first while loop you call your nextMove()
method. This method is incrementing both x and y in your first loop, hence why you don't get the output of the other while loops. If you changed your input destination to [3,4] you should get output of WEST,WEST,SOUTH
You could fix this so that only one of the dimensions is incremented at a time in your nextMove()
method by changing them to else if
like this
public Direction nextMove() {
if (xCar < xDestination){
xCar = xCar + car.x+ 1;
}
else if (xCar > xDestination){
xCar = xCar + car.x -1;
}
else if (yCar < yDestination){
yCar = yCar + car.y +1;
}
else if (yCar > yDestination){
yCar = yCar + car.y -1;
}
return null;