我将如何检查错误类前面的两个空格是否是一个没有任何东西并且没有超出边界的空白点?现在这就是我所拥有的
public void act()
{
if(canMove())
{
Location loc = getLocation();
Location nextLocation = loc.getAdjacentLocation(getDirection());
nextLocation = nextLocation.getAdjacentLocation(getDirection());
if (nextLocation == null)
{
move();
move();
}
}
}
这似乎不起作用,因为该错误什么都不做。