Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void saveOnFile() {
- try {
- ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream("object.txt"));
- output.writeObject(mediaList);
- output.close();
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
- public void readFromFile() {
- try {
- ObjectInputStream inStream = new ObjectInputStream(new FileInputStream("object.txt"));
- this.mediaList.add( (Media) inStream.readObject());
- inStream.close();
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
- java.lang.ClassCastException: java.util.ArrayList cannot be cast to project.Media
- at project.MediaHandler.readFromFile(MediaHandler.java:66)
- at project.Window.<init>(Window.java:73)
- at project.Window.main(Window.java:199)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement