To wrap my head around objects and arrays/arraylists, I decided to make a Tic-Tac-Toe app.
Here's the want to do:
The board is composed of a char array[3][3] which looks like/corresponds to:
codeindent - - - 0,0 1,0 2,0
c - - - 0,1 1,1 2,1
c - - - 0,2 1,2 2,2
I have the players input their move choice by entering a digit 1-9
1 2 3
4 5 6
7 8 9
Now I'd like an array where if I called index 4, it would return [0,1] in such a way I could point it directly to the char[][] array so I could do something along the lines of (I know that's not how its implemented but I'm putting var types for my own mental clarity)
char[][] boardArray[??? refArray[int playerMove]] = char currentPlayer
However, I just can't seem to wrap my head around what I need to do. I don't know what type of array it should be or why.
While typing this/looking stuff I just realized arrays are objects and can only store primitives in java. So I couldn't use an array to call an array...is this where I'd use Arraylists?
Thanks for all the answers! The purpose of this little exercise was to use arrays in an overly complicated and ridiculous fashion for the sole purpose of getting me practice with them, but it does seem that java as a language isn't capable of what I want to do in the fashion I want to do it. Definitely gonna go through and try out these other answers too