Three of the requirements are: The getOriginalObject method must return the A object received from the ObjectInputStream. The getOriginalObject method must return null if an A object is not received during deserialization attempts. The getOriginalObject method must return null if an exception is thrown when trying to deserialize. From the code below should I understand that: 1. In the try block, if the objectStream.readObject(); indeed brings back an object that is a descendant of A or an instance of A then it will return that value. 2. If it return an object of another type does it throw an error or what happens? 3. if the exception is thrown then it automatically returns null as per the code.
public A getOriginalObject(ObjectInputStream objectStream) {
        try {
            return (Solution.A) objectStream.readObject();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
and why is this not accepted?
public A getOriginalObject(ObjectInputStream objectStream) {
        try {  return (Solution.A) objectStream.readObject();

        } catch (IOException e) {
            System.out.println("Error IO");
        }
        catch (ClassNotFoundException f) {
            System.out.println("CNFE");
            }
        return null;
    }