for (i=1; i < 9; i++) {
        for (j=1; j < 9; j++) {
            if ( board[i][j] == "o" ) {
                j = j-1;
                if ( board[i][j] == "x" ) {
                    do {
                        j--;
                    }
                    while (board[i][j] != "-");
                    board[i][j] = ".";
                }
            }
        }
    }
I have this piece of code as part of a method, there are two versions, one as written above and one where j = j-1 is replaced with j = j+1 and j-- is replaced with j++
The positive version works perfectly fine but if I put in the negative version, the code compiles fine but when I attempt to run it nothing happens, the console just hangs and I have to close and reopen it. Can anyone tell me what I am doing wrong? Thanks in advance.
edit:
for (i=1; i < 9; i++) {
        for (j=1; j < 9; j++) {
            if ( board[i][j].equals("o") ) {
                j = j-1;
                if ( board[i][j].equals("x") ) {
                    do {
                        j--;
                    }
                    while (!board[i][j].equals("-"));
                    board[i][j] = ".";
                }
            }
        }
    }
I have edited the code as indicated but the problem persists
 
    