Java.io.ObjectOutputStream.writeObject() Method

Advertisements


Description

The java.io.ObjectOutputStream.writeObjectOverride(Object obj) method is used by subclasses to override the default writeObject method. This method is called by trusted subclasses of ObjectInputStream that constructed ObjectInputStream using the protected no-arg constructor. The subclass is expected to provide an override method with the modifier "final".

Declaration

Following is the declaration for java.io.ObjectOutputStream.writeObjectOverride() method

protected void writeObjectOverride(Object obj)

Parameters

  • obj -- object to be written to the underlying stream

Return Value

This method does not return a value.

Exception

  • IOException -- if there are I/O errors while writing to the underlying stream

Example

The following example shows the usage of java.io.ObjectOutputStream.writeObjectOverride() method.


Let us compile and run the above program, this will produce the following result:





Advertisements
Advertisements