Can ObjectInputStream.readObject () return null?

Can the ObjectInputStream.readObject () method return null?

+4
source share
1 answer

Yes.

You can serialize null by passing it to writeObject() , so you can return it from readObject() .

However, if you ask about an error case, the answer is no, because readObject() throws an exception in case of an error.

+9
source

Source: https://habr.com/ru/post/1342043/


All Articles