It would compile fine but would return a InvalidClassException when run.
When Dog(serializable sublass) is deserialised it would call the default constructor of its superclass because the superclass(Animal) isn't a Serializable Object.
Since the Animal class doesnt have a default constructor it would raise a flag and throw a suitable exception.
If you modify your code to look like this
then the code would not throw the exception when deserializing.