I am trying to deserialize a single variable in java however seem to be bumping into a problem when casting the value:
public void loadGrid(Sudoku testGrid) {
try {
FileInputStream fileIn = new FileInputStream(System.getProperty("user.home") + "\\tmp\\grid.grd");
ObjectInputStream in = new ObjectInputStream(fileIn);
testGrid.sudokuGrid = (Sudoku.sudokuGrid) in.readObject();
in.close();
fileIn.close();
} catch(IOException i) {
i.printStackTrace();
} catch(ClassNotFoundException c) {
c.printStackTrace();
}
}
Sudoku is a class containing an ArrayList of ArrayList variable. I run into:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Sudoku.sudokuGrid cannot be resolved to a type
(List<ArrayList<?>>) in.readObject();?