Pavan Tiwari
Pavan Tiwari

Reputation: 3187

Can i access the Inner Class which is not serialized

I am having a class Which implements serializable interface, it has one inner class which is not implementing serializable interface.

So Can i access the content of inner class at the receiver.

Thanks in advance.

Upvotes: 0

Views: 125

Answers (3)

Marcin Buciora
Marcin Buciora

Reputation: 449

The answer is No. Any data you expect as receiver need serialization. Inner class must implement ISerializable.

Upvotes: 2

Azodious
Azodious

Reputation: 13872

it has one inner class which is not implementing serializable interface. So Can i access the content of inner class at the receiver.

No. If it is not marked as Serializable, it can't be serialized.

Upvotes: 1

user207421
user207421

Reputation: 310850

If the inner class doesn't implement Serializable, it cannot be serialized. Any attempt to do so would throw NotSerializableException at the sender. As you would have discovered yourself when you tried it.

Upvotes: 3

Related Questions