Just because you print out a 0,0 then 3,1 doesn't mean that 3,1 was visited directly from 0,0. All you know is that 3,1 was visited at some time after 0,0.
Here's a modified version of your program which demonstrates this by printing out which square each square was visited from:
public class Knight_tour{
private static boolean[][] chessboard = new boolean[4][4];
public static void Knight_tour(int x,int y, int fromX, int fromY) {
if(((x < 0) || (x >= 4) || (y <0) || (y >= 4))){
//do nothing
}else{
if(chessboard[x][y] == true){
//if it is already visited, then, do nothing.
}
if(chessboard[x][y] != true) {
//If it is not visited then find more points like this.
chessboard[x][y]=true;
System.out.println(x +" "+ y + " (visited from " + fromX + ", " + fromY + ")");
Knight_tour(x+2, y+1, x, y);
Knight_tour(x+1, y-2, x, y);
Knight_tour(x+1, y+2, x, y);
Knight_tour(x-1, y+2, x, y);
Knight_tour(x-2, y-1, x, y);
Knight_tour(x-2, y+1, x, y);
Knight_tour(x-1, y-2, x, y);
Knight_tour(x+2, y-1, x, y);
}
}
}
public static void main(String[] args){
Knight_tour(0, 1, 0, 1);
}
}
Output:
0 1 (visited from 0, 1)
2 2 (visited from 0, 1)
3 0 (visited from 2, 2)
1 1 (visited from 3, 0)
3 2 (visited from 1, 1)
1 3 (visited from 3, 2)
2 1 (visited from 1, 3)
3 3 (visited from 2, 1)
1 2 (visited from 3, 3)
2 0 (visited from 1, 2)
0 0 (visited from 1, 2)
3 1 (visited from 1, 2)
2 3 (visited from 3, 1)
0 2 (visited from 2, 3)
1 0 (visited from 0, 2)
0 3 (visited from 1, 1)