I have been learning Java recently. I had a doubt and I am not sure if this is even possible to implement.
Suppose I have a class GameBoard and I create an array of objects,
GameBoard[][] board = new GameBoard[4][4];
Now if I need to call a non-static method of the class GameBoard, is it possible to call it as,
board.clear(); //clear the squares on the game board
or do I need to call the elements individually?
board[1][1].clear();
board[2][2].clear();
If it is possible to call board.clear(), is there a way to loop through the elements of the array to clear them inside the clear() method?
Object). You must iterate through the array using nestedforloops and callclear()on each one.