Javatpoint Logo
Javatpoint Logo

Java ObjectInputStream readField() Method

The readField() method of ObjectInputStream class is used to read the persistent fields from the stream and makes them available by name.

Syntax

Parameter

No parameter is passed.

Returns

the GetField object representing the persistent fields of the object being deserialized

Throws

ClassNotFoundException - if the class of a serialized object could not be found.

IOException - if an I/O error occurs.

NotActiveException - if the stream is not currently reading objects.

Example 1

Output:

Welcome to javaTpoint

Example 2

Output:

Using readFields() : Welcome to javaTpoint
----------------------------------------------------------
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