Javatpoint Logo
Javatpoint Logo

Java ObjectInputStream defaultReadObject() Method

The defaultReadObject() method of ObjectInputStream class is used to read the non-static and non-transient fields of the current class from this stream, i.e, one cannot use defaultReadObject() to read the static fields. This may only be called from the readObject method of the class being desterilized. You cannot use defaultReadObject() directly.

Syntax

Parameter

No parameter is passed.

Returns

The return type is void.

Throws

NotActiveException , ClassNotFoundException , IOException.

Example 1

Output:

string that is in task class : javaTpoint

Example 2

Output:

java.io.ObjectInputStream@1b28cdfa
string that is in task class  : javaTpoint





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA