Javatpoint Logo
Javatpoint Logo

Java ObjectInputStream readUnshared() Method

The readUnshared() method of ObjectInputStream class reads an "unshared" object from the ObjectInputStream. This method is identical to the readObject method, except that it prevents subsequent calls to readObject and readUnshared from returning additional references to the deserialized instance obtained via this call.

Syntax

Parameter

No parameter is passed.

Returns

Reference to the deserialized object

Throws

ClassNotFoundException

StreamCorruptedException

ObjectStreamException

OptionalDataException

IOException

Example 1

Output:

Welcome to 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