Hiding unselected array elements? - Java
Hi guys!. Currently I am using a 2 dimensional array with elements ranging from A1, A2, A3... to C3. When the user inputs a value (eg; A1) the program goes through the array to find a match. If the user's input matches one of the array elements then it will override that input with an x (to indicate a miss). However, the issue is, I would like my program to display the grids as so once the user has missed, for example: [x][ ][ ] [ ][ ][ ] [ ][ ][ ] rather than [x][A2][A3] [B1][B2][B3] [C1][C2][C3] I was wondering whether there was a way to take the user's input and only display the x along with the empty cells; Perhaps we can output the array normally but somehow hide/exclude the other elements that have not been selected by the user, thus only displaying x's and empty cells? https://code.sololearn.com/chk1UmVfA874/#java