I have a method that takes a char[][] as a parameter (basically a NxN grid of chars) and is utilizing an ArrayDeque in order to look through the whole 2d array. I want the row and column of a char[][] object removed from the ArrayDeque, and currently use this:
ArrayDeque stack=new ArrayDeque();
stack.push(grid[0][0]); //grid being the 2d array passed to the method
char[][] temp=(char[][]) stack.pop();
int row=temp.length-1;
int column=temp[0].length-1;
This compiles in Eclipse, but when run throws a ClassCastException. Is there a way to get the row and column without the char[][] case in the second line above?