为什么我的这段代码一直提示有找不到文件异常
package com.Java; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public class Objectserial { public static void main(String[] args) throws Exception{ String file="exer/obj.dat"; // //1:对象序列化 // ObjectOutputStream oos=new ObjectOutputStream( // new FileOutputStream(file)); // Studentserial stu =new Studentserial("1001","张安",21); // oos.writeObject(stu); // oos.flush(); // oos.close(); ObjectInputStream ois=new ObjectInputStream( new FileInputStream(file)); Studentserial stu =(Studentserial)ois.readObject(); System.out.println(stu); ois.close(); } }
这一段代码问题错在哪儿额?
我ecplise中新建了exer文件夹