88
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 TutorAspire
Example 2
Output:
[email protected] string that is in task class : TutorAspire
Next TopicJava ObjectInputStream