java - how does a compiler knows which class need to be serialize -
if declare class serializable, how compiler know class needs serialized using serializable keyword.
public class domain implements comparable<domain>, serializable{ }
compiler not serialize class, need write code write/ read object output stream. if class trying serialize not implementing interface, jvm throw run time error.
as marked class seriablizable implementing serializable interface, jvmwill treat serializable class. serialzable marker interface, means there no method need implemented when add interface class. marker interfaces treated specially jvm, flag class serializable.
Comments
Post a Comment