本帖最后由 高梦晓 于 2013-4-13 11:18 编辑
- try {
- fis = new FileInputStream("d:/tongxun/info.txt");
- ois = new ObjectInputStream(fis);
- list = (ArrayList)ois.readObject();
-
- System.out.println("请输入要删除的ID号:");
- k=sb.nextInt();
- for(Information ia:list)
- if(ia.getId()==k){
- n++;
- list.remove(ia);}
- l-=n;
- ois.close();
- fis.close();
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
复制代码 帮忙看看这段代码 就是不让我直接remove 应该怎么弄啊!
|