亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么會一直提示java.io.NotSerializableException: imooc.playlist.PlayList錯誤呢?

為什么會一直提示java.io.NotSerializableException: imooc.playlist.PlayList錯誤呢?

沫沫Michelle 2017-09-13 17:12:19
PlayList類和Song類都已經繼承了序列化接口?。????public class PlayList implements Serializable????public class Song implements Serializable主程序中的代碼:case 8: System.out.println("導出歌單 "); System.out.println("請輸入要導出的歌曲列表名稱: "); instr = scanner.next(); String fileName = instr + "的歌單.txt"; if (playListCollection.searchPlayListByName(instr) != null) { PlayList sPlayList = playListCollection.searchPlayListByName(instr); try { FileOutputStream fos = new FileOutputStream(fileName); ObjectOutputStream oos = new ObjectOutputStream(fos); FileInputStream fis = new FileInputStream(fileName); ObjectInputStream ois = new ObjectInputStream(fis); // 寫入對象// oos.writeObject(sPlayList); Iterator<Song> it = sPlayList.getMusicList().iterator(); while (it.hasNext()) { oos.writeObject(it.next()); } oos.flush(); // 讀對象信息 try { PlayList rPlayList = (PlayList) ois.readObject(); System.out.println(rPlayList); } catch (ClassNotFoundException e) { e.printStackTrace(); } oos.close(); fos.close(); ois.close(); fis.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } PlayListMenu(); break;
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 5159 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號