I am trying to move the O throughout the game board, then change the previously occupied space to a X. For some reason it won't add or subtract from row or col when I type in U D L or R.
public static void pickMove(char[][] array){ int row = 0; int col = 0; Scanner sc = new Scanner(System.in); System.out.print("Enter Move: "); //String letter = sc.next(); //String letter = sc.nextLine(); for(row=0; row<array.length; row++){ for(col=0; col<array.length; col++){ if (array[row][col] == 'O'){ char temp = array[row][col]; temp = '.'; if (sc.nextLine() == "U") row++; else if (letter == "D") row--; else if (letter == "L") col--; else if( letter == "R") col++; array[row][col] = 'X'; System.out.printf("%d %d ", row, col); } } } printBoard(array); }