在这个例子中,为什么使用空的“返回”(在catch块中)? (对不起,我的英语) 提前谢谢!在这个例子中,为什么使用空回归?
public class DeserializeDemo
{
public static void main(String [] args)
{
Employee employee;
try
{
ObjectInputStream in = new ObjectInputStream(new FileInputStream("E:\\serialization\\employee.ser"));
employee = (Employee) in.readObject();
in.close();
}catch(IOException i)
{
i.printStackTrace();
return; //this one
}catch(ClassNotFoundException c)
{
System.out.println("Employee class not found");
c.printStackTrace();
return; //...and this one!
}
System.out.println("Deserialized Employee...");
System.out.println("Name: " + employee.name);
}
}
可能重复[在Java中的void方法中返回关键字做什么?](http://stackoverflow.com/questions/744676/what-does-the-return-keyword-do-in-a- void-method-in-java) –